Show
Ignore:
Timestamp:
03/06/07 01:05:42 (23 months ago)
Author:
andersca
Message:

LayoutTests:

Reviewed by Maciej.

<rdar://problem/5035045>
REGRESSION: WebKit browser doesn't display image at http://www.metoffice.gov.uk/weather/satellite/index.html


Add some tests where image elements have id _and_ name elements.


  • fast/dom/HTMLDocument/document-special-properties-expected.txt:
  • fast/dom/HTMLDocument/document-special-properties.html:

WebCore:

Reviewed by Maciej.

<rdar://problem/5035045>
REGRESSION: WebKit browser doesn't display image at http://www.metoffice.gov.uk/weather/satellite/index.html


It turns out WinIE does allow you to access images by their id as special document properties. However, this is only
allowed when the element also has a name attribute. The value of the name attribute is ignored and can even be empty!


  • bindings/js/kjs_html.cpp: (KJS::JSHTMLDocument::namedItemGetter): Return jsUndefined() if the collection is empty.


  • html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::parseMappedAttribute): (WebCore::HTMLImageElement::insertedIntoDocument): (WebCore::HTMLImageElement::removedFromDocument):
  • html/HTMLImageElement.h: Add the id attribute value to the extra named item map.


  • html/HTMLNameCollection.cpp: (WebCore::HTMLNameCollection::traverseNextItem): Check for images with name attributes that match, as well as elements with id attributes that match where the element also has a name attribute.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/fast/dom/HTMLDocument/document-special-properties.html

    r11995 r19979  
    3333<img name="image5" width="0" height="0"> 
    3434<img id="image5" width="0" height="0"> 
     35<img id="image6" name="image6name" width="0" height="0"> 
     36<img id="image7" name="" width="0" height="0"> 
     37<img id="image8" name="image8name" width="0" height="0"> 
     38<img id="image8" width="0" height="0"> 
     39<img id="image8" name="image7name" width="0" height="0"> 
     40<img id="image9" name="image9name" width="0" height="0"> 
    3541 
    3642<form name="form1" width="0" height="0"></form> 
     
    151157        print(" " + e.tagName); 
    152158 
    153         if (e.name && e.id) { 
    154             print("(id,name)"); 
    155         } else if (e.name) { 
    156             print("(name)"); 
     159    if (e.name && e.id) { 
     160        print("(id,name)"); 
     161    } else if (e.name) { 
     162        print("(name)"); 
    157163        } else if (e.id) { 
    158             print("(id)"); 
    159         } 
     164        print("(id)"); 
     165    } 
    160166    } else if (e.navigator) { 
    161167        print(" WINDOW"); 
     
    174180    } else if (propVal.length) { 
    175181        print(" collection(" + propVal.length + ")"); 
    176         for (var i = 0; i < propVal.length; i++) { 
    177             printElement(propVal[i]); 
    178         } 
     182    for (var i = 0; i < propVal.length; i++) { 
     183        printElement(propVal[i]); 
     184    } 
    179185    } else { 
    180186        print(" single"); 
    181         printElement(propVal); 
     187    printElement(propVal); 
    182188    } 
    183189     
     
    191197testProperty("Image by id (multiple)", "image4"); 
    192198testProperty("Image by id/name mixed", "image5"); 
     199testProperty("Image by id, name present (unique)", "image6"); 
     200testProperty("Image by id, empty name present (unique)", "image7"); 
     201testProperty("Image by id, name present (multiple)", "image8"); 
     202testProperty("Image by name, id present (unique)", "image9name"); 
     203 
    193204print("<br>"); 
    194205