- Revision
- 98888
- Author
- [email protected]
- Date
- 2011-10-31 15:22:50 -0700 (Mon, 31 Oct 2011)
Log Message
Microdata: Support for itemid attribute.
https://bugs.webkit.org/show_bug.cgi?id=71007
Patch by Arko Saha <[email protected]> on 2011-10-31
Reviewed by Ryosuke Niwa.
Source/WebCore:
itemid attribute: To give a global identifier for the Microdata items.
The itemid attribute, if specified, must have a value that is a valid URL potentially
surrounded by spaces.
Spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html#attr-itemid
Tests: fast/dom/MicroData/itemid-attribute-test.html
fast/dom/MicroData/itemid-must-see-resolved-url.html
* html/HTMLElement.idl:
LayoutTests:
Added test-cases for itemid attribute.
* fast/dom/MicroData/itemid-attribute-test-expected.txt: Added.
* fast/dom/MicroData/itemid-attribute-test.html: Added.
* fast/dom/MicroData/itemid-must-see-resolved-url-expected.txt: Added.
* fast/dom/MicroData/itemid-must-see-resolved-url.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (98887 => 98888)
--- trunk/LayoutTests/ChangeLog 2011-10-31 22:13:01 UTC (rev 98887)
+++ trunk/LayoutTests/ChangeLog 2011-10-31 22:22:50 UTC (rev 98888)
@@ -1,3 +1,17 @@
+2011-10-31 Arko Saha <[email protected]>
+
+ Microdata: Support for itemid attribute.
+ https://bugs.webkit.org/show_bug.cgi?id=71007
+
+ Reviewed by Ryosuke Niwa.
+
+ Added test-cases for itemid attribute.
+
+ * fast/dom/MicroData/itemid-attribute-test-expected.txt: Added.
+ * fast/dom/MicroData/itemid-attribute-test.html: Added.
+ * fast/dom/MicroData/itemid-must-see-resolved-url-expected.txt: Added.
+ * fast/dom/MicroData/itemid-must-see-resolved-url.html: Added.
+
2011-10-31 Benjamin Poulain <[email protected]>
The test input-paste-undo.html needs update to work properly
Added: trunk/LayoutTests/fast/dom/MicroData/itemid-attribute-test-expected.txt (0 => 98888)
--- trunk/LayoutTests/fast/dom/MicroData/itemid-attribute-test-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/MicroData/itemid-attribute-test-expected.txt 2011-10-31 22:22:50 UTC (rev 98888)
@@ -0,0 +1,35 @@
+itemid attribute simple test.
+
+Created element of type: div
+Set attribute: itemid, value: http://example.com/foo
+
+The itemId attribute must be defined.
+PASS element.itemId is defined.
+PASS element.itemId is 'http://example.com/foo'
+
+itemId attribute must be case-senaitive.
+Created element of type: div
+Set attribute: itemid, value: http://example.com/FOO
+PASS createElement('div', {itemid: 'http://example.com/FOO'}).itemId == 'http://example.com/FOO'; is true
+
+itemId must strip leading and trailing whitespace.
+Created element of type: div
+Set attribute: itemid, value: http://example.com/foo
+PASS createElement('div', {itemid: ' http://example.com/foo '}).itemId == 'http://example.com/foo'; is true
+
+itemId must strip leading whitespace.
+Created element of type: div
+Set attribute: itemid, value: http://example.com/foo
+PASS createElement('div', {itemid: ' http://example.com/foo'}).itemId == 'http://example.com/foo'; is true
+
+itemId must strip trailing whitespace.
+Created element of type: div
+Set attribute: itemid, value: http://example.com/foo
+PASS createElement('div', {itemid: 'http://example.com/foo '}).itemId == 'http://example.com/foo'; is true
+
+itemId must be read/write.
+PASS element.itemId = 'http://example.com/bar'; element.itemId == 'http://example.com/bar' is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/MicroData/itemid-attribute-test.html (0 => 98888)
--- trunk/LayoutTests/fast/dom/MicroData/itemid-attribute-test.html (rev 0)
+++ trunk/LayoutTests/fast/dom/MicroData/itemid-attribute-test.html 2011-10-31 22:22:50 UTC (rev 98888)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<p>itemid attribute simple test.</p>
+<div id="console"></div>
+<script>
+var element = createElement('div', {itemid: 'http://example.com/foo'});
+
+debug("<br>The itemId attribute must be defined.");
+shouldBeDefined("element.itemId");
+shouldBe("element.itemId", "'http://example.com/foo'");
+
+debug("<br>itemId attribute must be case-senaitive.");
+shouldBeTrue("createElement('div', {itemid: 'http://example.com/FOO'}).itemId == 'http://example.com/FOO';");
+
+debug("<br>itemId must strip leading and trailing whitespace.");
+shouldBeTrue("createElement('div', {itemid: ' http://example.com/foo '}).itemId == 'http://example.com/foo';");
+
+debug("<br>itemId must strip leading whitespace.");
+shouldBeTrue("createElement('div', {itemid: ' http://example.com/foo'}).itemId == 'http://example.com/foo';");
+
+debug("<br>itemId must strip trailing whitespace.");
+shouldBeTrue("createElement('div', {itemid: 'http://example.com/foo '}).itemId == 'http://example.com/foo';");
+
+debug("<br>itemId must be read/write.");
+shouldBeTrue("element.itemId = 'http://example.com/bar'; element.itemId == 'http://example.com/bar'");
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/dom/MicroData/itemid-must-see-resolved-url-expected.txt (0 => 98888)
--- trunk/LayoutTests/fast/dom/MicroData/itemid-must-see-resolved-url-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/MicroData/itemid-must-see-resolved-url-expected.txt 2011-10-31 22:22:50 UTC (rev 98888)
@@ -0,0 +1,16 @@
+This tests the itemid attribute must see the resolved itemId URL.
+
+Created element of type: div
+Set attribute: itemid, value: foo
+PASS createElement('div',{itemid:'foo'}).itemId == currentUri.substring(0, currentUri.lastIndexOf('/')) + '/foo' is true
+
+Created element of type: div
+Set attribute: itemid, value: foo bar
+PASS createElement('div',{itemid:'foo bar'}).itemId == currentUri.substring(0, currentUri.lastIndexOf('/')) + '/foo%20bar' is true
+
+Created element of type: div
+PASS element.itemId == currentUri.substring(0, currentUri.lastIndexOf('/')) + '/bar' is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/MicroData/itemid-must-see-resolved-url.html (0 => 98888)
--- trunk/LayoutTests/fast/dom/MicroData/itemid-must-see-resolved-url.html (rev 0)
+++ trunk/LayoutTests/fast/dom/MicroData/itemid-must-see-resolved-url.html 2011-10-31 22:22:50 UTC (rev 98888)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<p>This tests the itemid attribute must see the resolved itemId URL.</p>
+<div id="console"></div>
+<script>
+var currentUri = location.href;
+
+shouldBeTrue("createElement('div',{itemid:'foo'}).itemId == currentUri.substring(0, currentUri.lastIndexOf('/')) + '/foo'");
+debug('');
+shouldBeTrue("createElement('div',{itemid:'foo bar'}).itemId == currentUri.substring(0, currentUri.lastIndexOf('/')) + '/foo%20bar'");
+debug('');
+
+var element = createElement('div',{});
+element.itemId = 'bar'
+shouldBeTrue("element.itemId == currentUri.substring(0, currentUri.lastIndexOf('/')) + '/bar'");
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (98887 => 98888)
--- trunk/Source/WebCore/ChangeLog 2011-10-31 22:13:01 UTC (rev 98887)
+++ trunk/Source/WebCore/ChangeLog 2011-10-31 22:22:50 UTC (rev 98888)
@@ -1,3 +1,20 @@
+2011-10-31 Arko Saha <[email protected]>
+
+ Microdata: Support for itemid attribute.
+ https://bugs.webkit.org/show_bug.cgi?id=71007
+
+ Reviewed by Ryosuke Niwa.
+
+ itemid attribute: To give a global identifier for the Microdata items.
+ The itemid attribute, if specified, must have a value that is a valid URL potentially
+ surrounded by spaces.
+ Spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html#attr-itemid
+
+ Tests: fast/dom/MicroData/itemid-attribute-test.html
+ fast/dom/MicroData/itemid-must-see-resolved-url.html
+
+ * html/HTMLElement.idl:
+
2011-10-31 Yury Semikhatsky <[email protected]>
window.onerror doesn't work with inline (attribute) scripts
Modified: trunk/Source/WebCore/html/HTMLElement.idl (98887 => 98888)
--- trunk/Source/WebCore/html/HTMLElement.idl 2011-10-31 22:13:01 UTC (rev 98887)
+++ trunk/Source/WebCore/html/HTMLElement.idl 2011-10-31 22:22:50 UTC (rev 98888)
@@ -68,7 +68,7 @@
attribute [Conditional=MICRODATA, Reflect] boolean itemScope;
readonly attribute [Conditional=MICRODATA] DOMSettableTokenList itemType;
- attribute [Conditional=MICRODATA, Reflect] DOMString itemId;
+ attribute [Conditional=MICRODATA, Reflect, URL] DOMString itemId;
readonly attribute [Conditional=MICRODATA] DOMSettableTokenList itemRef;
readonly attribute [Conditional=MICRODATA] DOMSettableTokenList itemProp;