Changeset 1416


Ignore:
Timestamp:
02/22/18 09:20:04 (4 months ago)
Author:
gogo
Message:

The IE7 Compatability for XinhaEasy?.js didn't work properly, replacing it with another one which does seem to (at least in Quirks Mode).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XinhaEasy.js

    r1410 r1416  
    336336xinha_init = xinha_init ? xinha_init : function() 
    337337{ 
    338   // For lte IE7 support of selectors to choose xinha areas.  This code take from 
    339   //  https://github.com/inexorabletash/polyfill/blob/master/polyfill.js#L4804 
    340   // which is "Unlicence" licenced, which is effective Public Domain 
    341   //  https://github.com/inexorabletash/polyfill/blob/master/LICENSE.md 
     338  // IE7 support for querySelectorAll. Supports multiple / grouped selectors 
     339  // and the attribute selector with a "for" attribute. http://www.codecouch.com/ 
     340  // http://www.codecouch.com/2012/05/adding-document-queryselectorall-support-to-ie-7/ 
    342341  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    343   if (!document.querySelectorAll) { 
    344     document.querySelectorAll = function(selectors) { 
    345       var style = document.createElement('style'), elements = [], element; 
    346       document.documentElement.firstChild.appendChild(style); 
    347       document._qsa = []; 
    348  
    349       style.styleSheet.cssText = selectors + '{x-qsa:expression(document._qsa && document._qsa.push(this))}'; 
    350       window.scrollBy(0, 0); 
    351       style.parentNode.removeChild(style); 
    352  
    353       while (document._qsa.length) { 
    354         element = document._qsa.shift(); 
    355         element.style.removeAttribute('x-qsa'); 
    356         elements.push(element); 
    357       } 
    358       document._qsa = null; 
    359       return elements; 
    360     }; 
    361   } 
    362  
    363   // Document.querySelector method 
    364   // Needed for: IE7- 
    365   if (!document.querySelector) { 
     342  if (!document.querySelectorAll)  
     343  { 
     344    (function(d, s) { 
     345      d=document, s=d.createStyleSheet(); 
     346      d.querySelectorAll = function(r, c, i, j, a) { 
     347        a=d.all, c=[], r = r.replace(/\[for\b/gi, '[htmlFor').split(','); 
     348        for (i=r.length; i--;) { 
     349          s.addRule(r[i], 'k:v'); 
     350          for (j=a.length; j--;) a[j].currentStyle.k && c.push(a[j]); 
     351          s.removeRule(0); 
     352        } 
     353        return c; 
     354      } 
     355    })(); 
     356  } 
     357 
     358  if (!document.querySelector)  
     359  { 
    366360    document.querySelector = function(selectors) { 
    367361      var elements = document.querySelectorAll(selectors); 
     
    390384  if(typeof xinha_editors == 'string') 
    391385  { 
    392     xinha_editors = [ xinha_editors ]; 
    393      
    394386    // A raw ID like we used to do 
    395387    if(document.getElementById(xinha_editors)) 
    396388    { 
    397       xinha_editors = [ xinha_editors ]; 
     389      xinha_editors = [ document.getElementById(xinha_editors) ]; 
    398390    } 
    399391     
     
    466458        { 
    467459          Array.prototype.push.apply(xinha_plugins, [ 'CharacterMap', 'ContextMenu', 'FancySelects', 'SmartReplace', 'SuperClean', 'TableOperations', 'ListOperations', 'PreserveScripts', 'PreserveSelection', 'WebKitResize' ]); 
     460 
     461           
    468462        }  
    469463        break; 
Note: See TracChangeset for help on using the changeset viewer.