Bug Tracker

Ticket #4308: support.diff

File support.diff, 1.3 KB (added by trixi, 11 years ago)

Patch for jQuery.support.style (tests also setAttribute)

  • support.js

     
    88                id = "script" + (new Date).getTime();
    99
    1010        div.style.display = "none";
    11         div.innerHTML = '   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select>';
     11        div.innerHTML = '   <link/><table></table><span></span><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select>';
    1212
    1313        var all = div.getElementsByTagName("*"),
    14                 a = div.getElementsByTagName("a")[0];
    15 
     14                a = div.getElementsByTagName("a")[0],
     15                span = div.getElementsByTagName("span")[0];
     16       
     17       
    1618        // Can't get basic test support
    17         if ( !all || !all.length || !a ) {
     19        if ( !all || !all.length || !a || !span ) {
    1820                return;
    1921        }
     22       
     23        span.setAttrbiute("style", "color: red;");
    2024
    2125        jQuery.support = {
    2226                // IE strips leading whitespace when .innerHTML is used
     
    3236               
    3337                // Get the style information from getAttribute
    3438                // (IE uses .cssText insted)
    35                 style: /red/.test( a.getAttribute("style") ),
     39                style: /red/.test( a.getAttribute("style") ) && /red/.test( span.getAttribute("style") ),
    3640               
    3741                // Make sure that URLs aren't manipulated
    3842                // (IE normalizes it by default)