RESOLVED FIXED 98025
[Microdata] itemprop names must not override builtin properties
https://bugs.webkit.org/show_bug.cgi?id=98025
Summary [Microdata] itemprop names must not override builtin properties
Arko Saha
Reported 2012-10-01 06:28:43 PDT
HTMLPropertiesCollection[propertyName] must not return PropertyNodeList if 'propertyName' is a method of HTMLPropertiesCollection interface. Sample test: test(function () { var testEl = makeEl('div',{itemscope:'itemscope', id:'outerDiv'}); var item = testEl.properties.item; testEl.innerHTML = '<div itemprop="item" id="innerDiv"></div>'; assert_equals( testEl.properties['item'], item, 'item' ); }, 'itemprop names must not override builtin properties'); Expected: testEl.properties['item'] should not return PropertyNodeList (NodeList contains innerDiv) because 'item' is a method of HTMLPropertiesCollection interface. It should return - function item() { [native code] } Actual: Returns "[object PropertyNodeList]"
Attachments
Patch (5.24 KB, patch)
2012-10-01 06:36 PDT, Arko Saha
haraken: review+
Arko Saha
Comment 1 2012-10-01 06:36:43 PDT
Kentaro Hara
Comment 2 2012-10-01 06:47:23 PDT
Comment on attachment 166464 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=166464&action=review Looks good. > Source/WebCore/ChangeLog:10 > + We should look in the prototype for functions before assuming it as > + an item's name. Return false if the prototype of the object has a > + property (function) with propertyName. Would you add a spec link to the ChangeLog? (I'm sure this change would be correct, but I'd like to verify it in the spec just in case.)
Arko Saha
Comment 3 2012-10-01 07:39:23 PDT
(In reply to comment #2) > Would you add a spec link to the ChangeLog? (I'm sure this change would be correct, but I'd like to verify it in the spec just in case.) Named properties spec is defined http://dev.w3.org/2006/webapi/WebIDL/#idl-named-properties According to named property visibility algorithm http://dev.w3.org/2006/webapi/WebIDL/#indexed-and-named-properties ... 7. If the result of calling the [[HasProperty]] internal method on prototype with property name P is true, then return false. ... Also [OverrideBuiltins] is not declared for any of the properties, hence no overriding is allowed in this case.
Kentaro Hara
Comment 4 2012-10-01 08:12:24 PDT
Comment on attachment 166464 [details] Patch Thanks for the clarification!
Arko Saha
Comment 5 2012-10-02 23:28:45 PDT
Note You need to log in before you can comment on or make changes to this bug.