Auto merge of #10711 - servo:wpt-20160419, r=Ms2ger

Update web-platform-tests to revision 20fa4a3a71ab7a2f75b4febbe2e98aeeaf022c2b

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10711)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-04-20 15:07:16 +05:30
commit eda711307c
111 changed files with 1563 additions and 7048 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,6 @@
[Event-constructors.html]
type: testharness
[Event constructors 4]
expected: FAIL
bug: https://github.com/servo/servo/issues/10744

View file

@ -213,3 +213,162 @@
[Element interface: element must inherit property "queryAll" with the proper type (37)]
expected: FAIL
[Node interface: attribute isConnected]
expected: FAIL
[Node interface: operation isSameNode(Node)]
expected: FAIL
[Node interface: new Document() must inherit property "isConnected" with the proper type (15)]
expected: FAIL
[Node interface: new Document() must inherit property "rootNode" with the proper type (17)]
expected: FAIL
[Node interface: new Document() must inherit property "isSameNode" with the proper type (31)]
expected: FAIL
[Node interface: calling isSameNode(Node) on new Document() with too few arguments must throw TypeError]
expected: FAIL
[Node interface: xmlDoc must inherit property "isConnected" with the proper type (15)]
expected: FAIL
[Node interface: xmlDoc must inherit property "rootNode" with the proper type (17)]
expected: FAIL
[Node interface: xmlDoc must inherit property "isSameNode" with the proper type (31)]
expected: FAIL
[Node interface: calling isSameNode(Node) on xmlDoc with too few arguments must throw TypeError]
expected: FAIL
[Node interface: document.doctype must inherit property "isConnected" with the proper type (15)]
expected: FAIL
[Node interface: document.doctype must inherit property "rootNode" with the proper type (17)]
expected: FAIL
[Node interface: document.doctype must inherit property "isSameNode" with the proper type (31)]
expected: FAIL
[Node interface: calling isSameNode(Node) on document.doctype with too few arguments must throw TypeError]
expected: FAIL
[Node interface: document.createDocumentFragment() must inherit property "isConnected" with the proper type (15)]
expected: FAIL
[Node interface: document.createDocumentFragment() must inherit property "rootNode" with the proper type (17)]
expected: FAIL
[Node interface: document.createDocumentFragment() must inherit property "isSameNode" with the proper type (31)]
expected: FAIL
[Node interface: calling isSameNode(Node) on document.createDocumentFragment() with too few arguments must throw TypeError]
expected: FAIL
[ShadowRoot interface: existence and properties of interface object]
expected: FAIL
[ShadowRoot interface object length]
expected: FAIL
[ShadowRoot interface object name]
expected: FAIL
[ShadowRoot interface: existence and properties of interface prototype object]
expected: FAIL
[ShadowRoot interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
[ShadowRoot interface: attribute mode]
expected: FAIL
[ShadowRoot interface: attribute host]
expected: FAIL
[Element interface: attribute slot]
expected: FAIL
[Element interface: operation attachShadow(ShadowRootInit)]
expected: FAIL
[Element interface: attribute shadowRoot]
expected: FAIL
[Element interface: attribute assignedSlot]
expected: FAIL
[Element interface: element must inherit property "slot" with the proper type (7)]
expected: FAIL
[Element interface: element must inherit property "hasAttributes" with the proper type (8)]
expected: FAIL
[Element interface: element must inherit property "attachShadow" with the proper type (24)]
expected: FAIL
[Element interface: calling attachShadow(ShadowRootInit) on element with too few arguments must throw TypeError]
expected: FAIL
[Element interface: element must inherit property "shadowRoot" with the proper type (25)]
expected: FAIL
[Element interface: element must inherit property "assignedSlot" with the proper type (48)]
expected: FAIL
[Node interface: element must inherit property "isConnected" with the proper type (15)]
expected: FAIL
[Node interface: element must inherit property "rootNode" with the proper type (17)]
expected: FAIL
[Node interface: element must inherit property "isSameNode" with the proper type (31)]
expected: FAIL
[Node interface: calling isSameNode(Node) on element with too few arguments must throw TypeError]
expected: FAIL
[Text interface: attribute assignedSlot]
expected: FAIL
[Text interface: document.createTextNode("abc") must inherit property "assignedSlot" with the proper type (2)]
expected: FAIL
[Node interface: document.createTextNode("abc") must inherit property "isConnected" with the proper type (15)]
expected: FAIL
[Node interface: document.createTextNode("abc") must inherit property "rootNode" with the proper type (17)]
expected: FAIL
[Node interface: document.createTextNode("abc") must inherit property "isSameNode" with the proper type (31)]
expected: FAIL
[Node interface: calling isSameNode(Node) on document.createTextNode("abc") with too few arguments must throw TypeError]
expected: FAIL
[Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "isConnected" with the proper type (15)]
expected: FAIL
[Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "rootNode" with the proper type (17)]
expected: FAIL
[Node interface: xmlDoc.createProcessingInstruction("abc", "def") must inherit property "isSameNode" with the proper type (31)]
expected: FAIL
[Node interface: calling isSameNode(Node) on xmlDoc.createProcessingInstruction("abc", "def") with too few arguments must throw TypeError]
expected: FAIL
[Node interface: document.createComment("abc") must inherit property "isConnected" with the proper type (15)]
expected: FAIL
[Node interface: document.createComment("abc") must inherit property "rootNode" with the proper type (17)]
expected: FAIL
[Node interface: document.createComment("abc") must inherit property "isSameNode" with the proper type (31)]
expected: FAIL
[Node interface: calling isSameNode(Node) on document.createComment("abc") with too few arguments must throw TypeError]
expected: FAIL

View file

@ -0,0 +1,9 @@
[DOMImplementation-createDocument.html]
type: testharness
bug: https://github.com/servo/servo/issues/10743
[createDocument test 179: metadata for "http://www.w3.org/1999/xhtml","",null]
expected: FAIL
[createDocument test 180: metadata for "http://www.w3.org/2000/svg","",null]
expected: FAIL

View file

@ -1,5 +1,463 @@
[Document-createEvent.html]
type: testharness
[Should throw NOT_SUPPORTED_ERR for pluralized non-legacy event interface "KeyEvent"]
bug: https://github.com/servo/servo/issues/10734
[AnimationEvent should be an alias for AnimationEvent.]
expected: FAIL
[createEvent('AnimationEvent') should be initialized correctly.]
expected: FAIL
[animationevent should be an alias for AnimationEvent.]
expected: FAIL
[createEvent('animationevent') should be initialized correctly.]
expected: FAIL
[ANIMATIONEVENT should be an alias for AnimationEvent.]
expected: FAIL
[createEvent('ANIMATIONEVENT') should be initialized correctly.]
expected: FAIL
[BeforeUnloadEvent should be an alias for BeforeUnloadEvent.]
expected: FAIL
[createEvent('BeforeUnloadEvent') should be initialized correctly.]
expected: FAIL
[beforeunloadevent should be an alias for BeforeUnloadEvent.]
expected: FAIL
[createEvent('beforeunloadevent') should be initialized correctly.]
expected: FAIL
[BEFOREUNLOADEVENT should be an alias for BeforeUnloadEvent.]
expected: FAIL
[createEvent('BEFOREUNLOADEVENT') should be initialized correctly.]
expected: FAIL
[CloseEvent should be an alias for CloseEvent.]
bug: https://github.com/servo/servo/issues/10737
expected: FAIL
[createEvent('CloseEvent') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10737
expected: FAIL
[closeevent should be an alias for CloseEvent.]
bug: https://github.com/servo/servo/issues/10737
expected: FAIL
[createEvent('closeevent') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10737
expected: FAIL
[CLOSEEVENT should be an alias for CloseEvent.]
bug: https://github.com/servo/servo/issues/10737
expected: FAIL
[createEvent('CLOSEEVENT') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10737
expected: FAIL
[CompositionEvent should be an alias for CompositionEvent.]
expected: FAIL
[createEvent('CompositionEvent') should be initialized correctly.]
expected: FAIL
[compositionevent should be an alias for CompositionEvent.]
expected: FAIL
[createEvent('compositionevent') should be initialized correctly.]
expected: FAIL
[COMPOSITIONEVENT should be an alias for CompositionEvent.]
expected: FAIL
[createEvent('COMPOSITIONEVENT') should be initialized correctly.]
expected: FAIL
[DeviceMotionEvent should be an alias for DeviceMotionEvent.]
expected: FAIL
[createEvent('DeviceMotionEvent') should be initialized correctly.]
expected: FAIL
[devicemotionevent should be an alias for DeviceMotionEvent.]
expected: FAIL
[createEvent('devicemotionevent') should be initialized correctly.]
expected: FAIL
[DEVICEMOTIONEVENT should be an alias for DeviceMotionEvent.]
expected: FAIL
[createEvent('DEVICEMOTIONEVENT') should be initialized correctly.]
expected: FAIL
[DeviceOrientationEvent should be an alias for DeviceOrientationEvent.]
expected: FAIL
[createEvent('DeviceOrientationEvent') should be initialized correctly.]
expected: FAIL
[deviceorientationevent should be an alias for DeviceOrientationEvent.]
expected: FAIL
[createEvent('deviceorientationevent') should be initialized correctly.]
expected: FAIL
[DEVICEORIENTATIONEVENT should be an alias for DeviceOrientationEvent.]
expected: FAIL
[createEvent('DEVICEORIENTATIONEVENT') should be initialized correctly.]
expected: FAIL
[DragEvent should be an alias for DragEvent.]
expected: FAIL
[createEvent('DragEvent') should be initialized correctly.]
expected: FAIL
[dragevent should be an alias for DragEvent.]
expected: FAIL
[createEvent('dragevent') should be initialized correctly.]
expected: FAIL
[DRAGEVENT should be an alias for DragEvent.]
expected: FAIL
[createEvent('DRAGEVENT') should be initialized correctly.]
expected: FAIL
[ErrorEvent should be an alias for ErrorEvent.]
bug: https://github.com/servo/servo/issues/10738
expected: FAIL
[createEvent('ErrorEvent') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10738
expected: FAIL
[errorevent should be an alias for ErrorEvent.]
bug: https://github.com/servo/servo/issues/10738
expected: FAIL
[createEvent('errorevent') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10738
expected: FAIL
[ERROREVENT should be an alias for ErrorEvent.]
bug: https://github.com/servo/servo/issues/10738
expected: FAIL
[createEvent('ERROREVENT') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10738
expected: FAIL
[FocusEvent should be an alias for FocusEvent.]
bug: https://github.com/servo/servo/issues/10739
expected: FAIL
[createEvent('FocusEvent') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10739
expected: FAIL
[focusevent should be an alias for FocusEvent.]
bug: https://github.com/servo/servo/issues/10739
expected: FAIL
[createEvent('focusevent') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10739
expected: FAIL
[FOCUSEVENT should be an alias for FocusEvent.]
bug: https://github.com/servo/servo/issues/10739
expected: FAIL
[createEvent('FOCUSEVENT') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10739
expected: FAIL
[HashChangeEvent should be an alias for HashChangeEvent.]
expected: FAIL
[createEvent('HashChangeEvent') should be initialized correctly.]
expected: FAIL
[hashchangeevent should be an alias for HashChangeEvent.]
expected: FAIL
[createEvent('hashchangeevent') should be initialized correctly.]
expected: FAIL
[HASHCHANGEEVENT should be an alias for HashChangeEvent.]
expected: FAIL
[createEvent('HASHCHANGEEVENT') should be initialized correctly.]
expected: FAIL
[IDBVersionChangeEvent should be an alias for IDBVersionChangeEvent.]
expected: FAIL
[createEvent('IDBVersionChangeEvent') should be initialized correctly.]
expected: FAIL
[idbversionchangeevent should be an alias for IDBVersionChangeEvent.]
expected: FAIL
[createEvent('idbversionchangeevent') should be initialized correctly.]
expected: FAIL
[IDBVERSIONCHANGEEVENT should be an alias for IDBVersionChangeEvent.]
expected: FAIL
[createEvent('IDBVERSIONCHANGEEVENT') should be initialized correctly.]
expected: FAIL
[PageTransitionEvent should be an alias for PageTransitionEvent.]
expected: FAIL
[createEvent('PageTransitionEvent') should be initialized correctly.]
expected: FAIL
[pagetransitionevent should be an alias for PageTransitionEvent.]
expected: FAIL
[createEvent('pagetransitionevent') should be initialized correctly.]
expected: FAIL
[PAGETRANSITIONEVENT should be an alias for PageTransitionEvent.]
expected: FAIL
[createEvent('PAGETRANSITIONEVENT') should be initialized correctly.]
expected: FAIL
[PopStateEvent should be an alias for PopStateEvent.]
expected: FAIL
[createEvent('PopStateEvent') should be initialized correctly.]
expected: FAIL
[popstateevent should be an alias for PopStateEvent.]
expected: FAIL
[createEvent('popstateevent') should be initialized correctly.]
expected: FAIL
[POPSTATEEVENT should be an alias for PopStateEvent.]
expected: FAIL
[createEvent('POPSTATEEVENT') should be initialized correctly.]
expected: FAIL
[ProgressEvent should be an alias for ProgressEvent.]
bug: https://github.com/servo/servo/issues/10740
expected: FAIL
[createEvent('ProgressEvent') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10740
expected: FAIL
[progressevent should be an alias for ProgressEvent.]
bug: https://github.com/servo/servo/issues/10740
expected: FAIL
[createEvent('progressevent') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10740
expected: FAIL
[PROGRESSEVENT should be an alias for ProgressEvent.]
bug: https://github.com/servo/servo/issues/10740
expected: FAIL
[createEvent('PROGRESSEVENT') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10740
expected: FAIL
[StorageEvent should be an alias for StorageEvent.]
bug: https://github.com/servo/servo/issues/10736
expected: FAIL
[createEvent('StorageEvent') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10736
expected: FAIL
[storageevent should be an alias for StorageEvent.]
bug: https://github.com/servo/servo/issues/10736
expected: FAIL
[createEvent('storageevent') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10736
expected: FAIL
[STORAGEEVENT should be an alias for StorageEvent.]
bug: https://github.com/servo/servo/issues/10736
expected: FAIL
[createEvent('STORAGEEVENT') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10736
expected: FAIL
[SVGEvents should be an alias for Event.]
bug: https://github.com/servo/servo/issues/10741
expected: FAIL
[createEvent('SVGEvents') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10741
expected: FAIL
[svgevents should be an alias for Event.]
bug: https://github.com/servo/servo/issues/10741
expected: FAIL
[createEvent('svgevents') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10741
expected: FAIL
[SVGEVENTS should be an alias for Event.]
bug: https://github.com/servo/servo/issues/10741
expected: FAIL
[createEvent('SVGEVENTS') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10741
expected: FAIL
[SVGZoomEvent should be an alias for SVGZoomEvent.]
expected: FAIL
[createEvent('SVGZoomEvent') should be initialized correctly.]
expected: FAIL
[svgzoomevent should be an alias for SVGZoomEvent.]
expected: FAIL
[createEvent('svgzoomevent') should be initialized correctly.]
expected: FAIL
[SVGZOOMEVENT should be an alias for SVGZoomEvent.]
expected: FAIL
[createEvent('SVGZOOMEVENT') should be initialized correctly.]
expected: FAIL
[SVGZoomEvents should be an alias for SVGZoomEvent.]
expected: FAIL
[createEvent('SVGZoomEvents') should be initialized correctly.]
expected: FAIL
[svgzoomevents should be an alias for SVGZoomEvent.]
expected: FAIL
[createEvent('svgzoomevents') should be initialized correctly.]
expected: FAIL
[SVGZOOMEVENTS should be an alias for SVGZoomEvent.]
expected: FAIL
[createEvent('SVGZOOMEVENTS') should be initialized correctly.]
expected: FAIL
[TextEvent should be an alias for CompositionEvent.]
expected: FAIL
[createEvent('TextEvent') should be initialized correctly.]
expected: FAIL
[textevent should be an alias for CompositionEvent.]
expected: FAIL
[createEvent('textevent') should be initialized correctly.]
expected: FAIL
[TEXTEVENT should be an alias for CompositionEvent.]
expected: FAIL
[createEvent('TEXTEVENT') should be initialized correctly.]
expected: FAIL
[TrackEvent should be an alias for TrackEvent.]
expected: FAIL
[createEvent('TrackEvent') should be initialized correctly.]
expected: FAIL
[trackevent should be an alias for TrackEvent.]
expected: FAIL
[createEvent('trackevent') should be initialized correctly.]
expected: FAIL
[TRACKEVENT should be an alias for TrackEvent.]
expected: FAIL
[createEvent('TRACKEVENT') should be initialized correctly.]
expected: FAIL
[TransitionEvent should be an alias for TransitionEvent.]
expected: FAIL
[createEvent('TransitionEvent') should be initialized correctly.]
expected: FAIL
[transitionevent should be an alias for TransitionEvent.]
expected: FAIL
[createEvent('transitionevent') should be initialized correctly.]
expected: FAIL
[TRANSITIONEVENT should be an alias for TransitionEvent.]
expected: FAIL
[createEvent('TRANSITIONEVENT') should be initialized correctly.]
expected: FAIL
[WebGLContextEvent should be an alias for WebGLContextEvent.]
bug: https://github.com/servo/servo/issues/10742
expected: FAIL
[createEvent('WebGLContextEvent') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10742
expected: FAIL
[webglcontextevent should be an alias for WebGLContextEvent.]
bug: https://github.com/servo/servo/issues/10742
expected: FAIL
[createEvent('webglcontextevent') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10742
expected: FAIL
[WEBGLCONTEXTEVENT should be an alias for WebGLContextEvent.]
bug: https://github.com/servo/servo/issues/10742
expected: FAIL
[createEvent('WEBGLCONTEXTEVENT') should be initialized correctly.]
bug: https://github.com/servo/servo/issues/10742
expected: FAIL
[WheelEvent should be an alias for WheelEvent.]
expected: FAIL
[createEvent('WheelEvent') should be initialized correctly.]
expected: FAIL
[wheelevent should be an alias for WheelEvent.]
expected: FAIL
[createEvent('wheelevent') should be initialized correctly.]
expected: FAIL
[WHEELEVENT should be an alias for WheelEvent.]
expected: FAIL
[createEvent('WHEELEVENT') should be initialized correctly.]
expected: FAIL
[Should throw NOT_SUPPORTED_ERR for pluralized non-legacy event interface "KeyEvents"]
expected: FAIL
bug: https://github.com/servo/servo/issues/10735

View file

@ -1,5 +1,6 @@
[rootNode.html]
type: testharness
bug: https://github.com/servo/servo/issues/10747
[rootNode attribute must return the context object when it does not have any parent]
expected: FAIL

View file

@ -1,5 +0,0 @@
[eventsource-eventtarget.htm]
type: testharness
[dedicated worker - EventSource: addEventListener()]
expected: FAIL

View file

@ -0,0 +1,7 @@
[eventsource-eventtarget.worker]
type: testharness
expected: TIMEOUT
bug: https://github.com/servo/servo/issues/8925
[dedicated worker - EventSource: addEventListener()]
expected: TIMEOUT

View file

@ -0,0 +1,4 @@
[canvas-fallback.html]
type: reftest
expected: FAIL
bug: https://github.com/servo/servo/issues/10733

View file

@ -1,5 +1,6 @@
[readwrite-readonly.html]
type: testharness
bug: https://github.com/servo/servo/issues/10732
[The :read-write pseudo-class must match input elements to which the readonly attribute applies, and that are mutable]
expected: FAIL
@ -48,3 +49,9 @@
[The :read-only pseudo-class must not match elements that are editing hosts]
expected: FAIL
[The :read-write pseudo-class must not match input elements to which the readonly attribute does not apply]
expected: FAIL
[The :read-only pseudo-class must match input elements to which the readonly attribute does not apply]
expected: FAIL

View file

@ -1 +1 @@
f9608022caf7f223dfdfe960c31fb5fe7eb0d1f1
3d4416e1b0ae758e68900f725979238cc0128f8b

View file

@ -2,3 +2,4 @@
type: testharness
[WebGL test #6: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Blob slice</title>
<link rel=help href="http://dev.w3.org/2006/webapi/FileAPI/#slice-method-algo">
<link rel=help href="https://w3c.github.io/FileAPI/#slice-method-algo">
<link rel=author title="Saurabh Anand" href="mailto:saurabhanandiit@gmail.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
@ -162,6 +162,23 @@ test(function() {
var invalidTypes = [
"\xFF",
"te\x09xt/plain",
"te\x00xt/plain",
"te\x1Fxt/plain",
"te\x7Fxt/plain"
];
invalidTypes.forEach(function(type) {
test_blob(function() {
var blob = new Blob(["PASS"]);
return blob.slice(0, 4, type);
}, {
expected: "PASS",
type: "",
desc: "Invalid contentType (" + format_value(type) + ")"
});
});
var validTypes = [
"te(xt/plain",
"te)xt/plain",
"te<xt/plain",
@ -180,23 +197,6 @@ var invalidTypes = [
"te{xt/plain",
"te}xt/plain",
"te\x20xt/plain",
"te\x09xt/plain",
"te\x00xt/plain",
"te\x1Fxt/plain",
"te\x7Fxt/plain"
];
invalidTypes.forEach(function(type) {
test_blob(function() {
var blob = new Blob(["PASS"]);
return blob.slice(0, 4, type);
}, {
expected: "PASS",
type: "",
desc: "Invalid contentType (" + format_value(type) + ")"
});
});
var validTypes = [
"TEXT/PLAIN",
"text/plain;charset = UTF-8",
"text/plain;charset=UTF-8"

View file

@ -0,0 +1,5 @@
(function() {
test(function() {
assert_true(false);
}, 'Test suite not implemented yet.');
})();

View file

@ -2,10 +2,10 @@
<meta charset=utf8>
<meta content=long name=timeout>
<meta content="width=device-width, initial-scale=1" name=viewport>
<title>Ambient Light Events Test Suite</title>
<title>Ambient Light Sensor Test Suite</title>
<link rel="help" href="http://www.w3.org/TR/ambient-light/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="DeviceLightEvent_tests.js"></script>
<script src="AmbientLightSensor.js"></script>
<div id="log"></div>

View file

@ -1,403 +0,0 @@
(function() {
//inheritance tests
test(function() {
var event = new DeviceLightEvent('');
assert_true(event instanceof window.DeviceLightEvent);
}, 'the event is an instance of DeviceLightEvent');
test(function() {
var event = new DeviceLightEvent('');
assert_true(event instanceof window.Event);
}, 'the event inherits from Event');
//Type attribute tests
test(function() {
assert_throws(new TypeError(), function() {
new DeviceLightEvent();
}, 'First argument is required, so was expecting a TypeError.');
}, 'Missing type argument');
test(function() {
var event = new DeviceLightEvent(undefined);
assert_equals(event.type, 'undefined');
}, 'Event type set to undefined');
test(function() {
var event = new DeviceLightEvent(null);
assert_equals(event.type, 'null');
}, 'type argument is null');
test(function() {
var event = new DeviceLightEvent(123);
assert_equals(event.type, '123');
}, 'type argument is number');
test(function() {
var event = new DeviceLightEvent(new Number(123));
assert_equals(event.type, '123');
}, 'type argument is Number');
test(function() {
var event = new DeviceLightEvent([]);
assert_equals(event.type, '');
}, 'type argument is array');
test(function() {
var event = new DeviceLightEvent(new Array());
assert_equals(event.type, '');
}, 'type argument is instance of Array');
test(function() {
var event = new DeviceLightEvent(['t', ['e', ['s', ['t']]]]);
assert_equals(event.type, 't,e,s,t');
}, 'type argument is nested array');
test(function() {
var event = new DeviceLightEvent(Math);
assert_equals(event.type, '[object Math]');
}, 'type argument is host object');
test(function() {
var event = new DeviceLightEvent(true);
assert_equals(event.type, 'true');
}, 'type argument is boolean (true)');
test(function() {
var event = new DeviceLightEvent(new Boolean(true));
assert_equals(event.type, 'true');
}, 'type argument is instance of Boolean (true)');
test(function() {
var event = new DeviceLightEvent(false);
assert_equals(event.type, 'false');
}, 'type argument is boolean (false)');
test(function() {
var event = new DeviceLightEvent(new Boolean(false));
assert_equals(event.type, 'false');
}, 'type argument is instance of Boolean (false)');
test(function() {
var event = new DeviceLightEvent('test');
assert_equals(event.type, 'test');
}, 'type argument is string');
test(function() {
var event = new DeviceLightEvent(new String('test'));
assert_equals(event.type, 'test');
}, 'type argument is instance of String');
test(function() {
var event = new DeviceLightEvent(function test() {});
assert_regexp_match(event.type, /function test.+{\s?}/);
}, 'type argument is function');
test(function() {
var event = new DeviceLightEvent({
toString: function() {
return '123';
}
});
assert_equals(event.type, '123');
}, 'type argument is complex object, with toString method');
test(function() {
assert_throws(new TypeError(), function() {
new DeviceLightEvent({
toString: function() {
return function() {}
}
});
});
}, 'toString is of type function');
//eventInitDict attribute tests
test(function() {
var event = new DeviceLightEvent('test', undefined);
assert_equals(event.value, Infinity);
}, 'eventInitDict argument sets to undefined');
test(function() {
var event = new DeviceLightEvent('test', null);
assert_equals(event.value, Infinity);
}, 'eventInitDict argument is null');
test(function() {
var date = new Date();
assert_throws(new TypeError(), function() {
new DeviceLightEvent('test', date);
});
}, 'eventInitDict argument is Date object');
test(function() {
var regexp = /abc/;
assert_throws(new TypeError(), function() {
new DeviceLightEvent('test', regexp);
});
}, 'eventInitDict argument is RegExp object');
test(function() {
assert_throws(new TypeError(), function() {
new DeviceLightEvent('test', false);
});
}, 'eventInitDict argument is boolean');
test(function() {
assert_throws(new TypeError(), function() {
new DeviceLightEvent('test', 123);
});
}, 'eventInitDict argument is number');
test(function() {
assert_throws(new TypeError(), function() {
new DeviceLightEvent('test', 'hello');
});
}, 'eventInitDict argument is string');
//test readonly attribute double value;
test(function() {
var event = new DeviceLightEvent('test');
assert_readonly(event, 'value', 'readonly attribute value');
}, 'value is readonly');
test(function() {
var event = new DeviceLightEvent('test');
assert_equals(event.value, Infinity);
}, 'value initializes to positive Infinity');
test(function() {
var event = new DeviceLightEvent('test', {
value: Infinity
});
assert_equals(event.value, Infinity);
}, 'value set to positive Infinity');
test(function() {
var event = new DeviceLightEvent('test', {
value: -Infinity
});
assert_equals(event.value, -Infinity);
}, 'value set to negative Infinity');
test(function() {
var event = new DeviceLightEvent('test', {
value: 0
});
assert_equals(event.value, 0);
}, 'value set to 0');
test(function() {
var event = new DeviceLightEvent('test', {
value: 1
});
assert_equals(event.value, 1);
}, 'value set to 1');
test(function() {
var event = new DeviceLightEvent('test', {
value: -1
});
assert_equals(event.value, -1);
}, 'value set to -1');
test(function() {
var event = new DeviceLightEvent('test', {
value: 0.5
});
assert_equals(event.value, 0.5);
}, 'value set to 0.5');
test(function() {
var event = new DeviceLightEvent('test', {
value: false
});
assert_equals(event.value, 0, 'value set to false, converts to 0.');
}, 'value set to false');
test(function() {
var event = new DeviceLightEvent('test', {
value: true
});
assert_equals(event.value, 1, 'value set to true, converts to 1.');
}, 'value set to true');
test(function() {
var prop = {
value: undefined
};
try {
var event = new DeviceLightEvent('test', prop);
assert_true(isNaN(event.value));
} catch(e) {
assert_unreached('error message: ' + e.message);
}
}, 'value of undefined resolves to NaN');
test(function() {
var event = new DeviceLightEvent('test', {
value: null
});
assert_equals(event.value, 0, 'value resolves to 0');
}, 'value of null resolves to 0');
test(function() {
var event = new DeviceLightEvent('test', {
value: ''
});
assert_equals(event.value, 0, 'value must resolve to 0');
}, 'value of empty string must resolve to 0');
test(function() {
var event = new DeviceLightEvent('test', {
value: '\u0020'
});
assert_equals(event.value, 0, 'value must resolve to 0');
}, 'value of U+0020 must resolve to 0');
test(function() {
var event = new DeviceLightEvent('test', {
value: '\u0020\u0020\u0020\u0020\u0020\u0020'
});
assert_equals(event.value, 0, 'value must resolve to 0');
}, 'value of multiple U+0020 must resolve to 0');
test(function() {
var event = new DeviceLightEvent('test', {
value: '\u0020\u0020\u00201234\u0020\u0020\u0020'
});
assert_equals(event.value, 1234, 'converts to 1234');
}, 'converts to 1234');
test(function() {
var event = new DeviceLightEvent('test', {
value: []
});
assert_equals(event.value, 0, 'converts to 0');
}, 'converts to 0');
test(function() {
var prop = {
value: {}
};
try {
var event = new DeviceLightEvent('test', prop);
assert_true(isNaN(event.value));
} catch(e) {
assert_unreached('error message: ' + e.message);
}
}, 'value of {} resolves to NaN');
test(function() {
var prop = {
get value() {
return NaN;
}
};
try {
var event = new DeviceLightEvent('test', prop);
assert_true(isNaN(event.value));
} catch(e) {
assert_unreached('error message: ' + e.message);
}
}, 'value resolves to NaN');
test(function() {
var prop = {
get value() {
return '123';
}
};
var event = new DeviceLightEvent('test', prop);
assert_equals(event.value, 123, 'converts to 123');
}, 'value resolves 123');
//test attribute EventHandler ondevicelight;
test(function() {
var desc = 'window.ondevicelight did not accept callable object',
descidl = 'Expected to find ondevicelight attribute on window object',
func = function() {};
assert_idl_attribute(window, 'ondevicelight', descidl);
window.ondevicelight = func;
assert_equals(window.ondevicelight, func, desc);
}, 'expected ondevicelight on window and to be set to function');
test(function() {
var desc = 'window.ondevicelight must be null';
assert_equals(window.ondevicelight, null, desc);
}, 'ondevicelight is null');
test(function() {
var desc = 'window.ondevicelight did not treat noncallable as null';
window.ondevicelight = function() {};
window.ondevicelight = {};
assert_equals(window.ondevicelight, null, desc);
}, 'treat object as null');
test(function() {
var desc = 'window.ondevicelight did not treat noncallable as null';
window.ondevicelight = function() {};
window.ondevicelight = {
call: 'test'
};
assert_equals(window.ondevicelight, null, desc);
}, 'treat object with non-callable call property as null');
test(function() {
var desc = 'window.ondevicelight did not treat noncallable (string) as null';
window.ondevicelight = function() {};
window.ondevicelight = 'string';
assert_equals(window.ondevicelight, null, desc);
}, 'treat string as null');
test(function() {
var desc = 'window.ondevicelight did not treat noncallable (number) as null';
window.ondevicelight = function() {};
window.ondevicelight = 123;
assert_equals(window.ondevicelight, null, desc);
}, 'treat number as null');
test(function() {
var desc = 'window.ondevicelight did not treat noncallable (undefined) as null';
window.ondevicelight = function() {};
window.ondevicelight = undefined;
assert_equals(window.ondevicelight, null, desc);
}, 'treat undefined as null');
test(function() {
var desc = 'window.ondevicelight did not treat noncallable (array) as null';
window.ondevicelight = function() {};
window.ondevicelight = [];
assert_equals(window.ondevicelight, null, desc);
}, 'treat array as null');
test(function() {
var desc = 'window.ondevicelight did not treat noncallable host object as null';
window.ondevicelight = function() {};
window.ondevicelight = window.Node;
assert_equals(window.ondevicelight, null, desc);
}, 'treat non-callable host object as null');
//Async tests
var t = async_test('test if DeviceLightEvent received');
window.addEventListener('devicelight', function(e) {
t.step(function() {
var msg = 'expected instance of DeviceLightEvent: ';
assert_true(e instanceof window.DeviceLightEvent, msg);
assert_idl_attribute(e, 'value', 'event has value property');
});
t.done();
});
var t2 = async_test('test if DeviceLightEvent received (event handler attribute)');
window.ondevicelight = function(e) {
t2.step(function() {
var msg = 'expected instance of DeviceLightEvent: ';
assert_true(e instanceof window.DeviceLightEvent, msg);
assert_idl_attribute(e, 'value', 'event has value property');
});
t2.done();
};
})();

View file

@ -1,3 +1,5 @@
@zqzhang
@Volker-E
@dontcallmedom
@tobie
@riju

View file

@ -1,6 +1,6 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Ambient Light Events IDL tests</title>
<title>Ambient Light Sensor IDL tests</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="http://www.w3.org/TR/ambient-light/">
<script src="/resources/testharness.js"></script>
@ -14,46 +14,91 @@
</style>
<div id="log"></div>
<pre id="untested_idl">
[PrimaryGlobal]
interface Window {
<pre id="idl">
interface Event {
};
interface Event {
interface Error {
};
dictionary EventInit {
};
</pre>
<pre id='idl'>
partial interface Window {
attribute EventHandler ondevicelight;
<pre id="generic-idl">
interface Sensor : EventTarget {
readonly attribute SensorState state;
readonly attribute SensorReading? reading;
void start();
void stop();
attribute EventHandler onchange;
attribute EventHandler onstatechange;
attribute EventHandler onerror;
};
dictionary DeviceLightEventInit : EventInit {
unrestricted double value;
dictionary SensorOptions {
double? frequency;
};
[Constructor (DOMString type, optional DeviceLightEventInit eventInitDict)]
interface DeviceLightEvent : Event {
readonly attribute unrestricted double value;
enum SensorState {
"idle",
"activating",
"active",
"errored"
};
interface SensorReading {
readonly attribute DOMHighResTimeStamp timeStamp;
};
[Constructor(DOMString type, SensorReadingEventInit eventInitDict)]
interface SensorReadingEvent : Event {
readonly attribute SensorReading reading;
};
dictionary SensorReadingEventInit : EventInit {
SensorReading reading;
};
[Constructor(DOMString type, SensorErrorEventInit errorEventInitDict)]
interface SensorErrorEvent : Event {
readonly attribute Error error;
};
dictionary SensorErrorEventInit : EventInit {
Error error;
};
</pre>
<pre id="ambient-light-idl">
[Constructor(optional SensorOptions sensorOptions)]
interface AmbientLightSensor : Sensor {
readonly attribute AmbientLightSensorReading? reading;
};
[Constructor(AmbientLightSensorReadingInit ambientLightSensorReadingInit)]
interface AmbientLightSensorReading : SensorReading {
readonly attribute unrestricted double illuminance;
};
dictionary AmbientLightSensorReadingInit {
unrestricted double illuminance;
};
</pre>
<script>
(function() {
"use strict";
var idl_array = new IdlArray();
// replace 'EventHandler' and 'unrestricted double' unrecognised by idlharness.js
var idls = document.getElementById('idl').textContent.replace(/EventHandler/g, 'Function?').replace(/unrestricted double/g, 'double');
idl_array.add_untested_idls(document.getElementById('untested_idl').textContent);
idl_array.add_idls(idls);
idl_array.add_untested_idls(document.getElementById('idl').textContent);
idl_array.add_untested_idls(document.getElementById('generic-idl').textContent);
idl_array.add_idls(document.getElementById('ambient-light-idl').textContent);
idl_array.add_objects({
Window: ['window'],
DeviceLightEvent: ['new DeviceLightEvent("foo")']
AmbientLightSensor: ['new AmbientLightSensor();'],
AmbientLightSensorReading: ['new AmbientLightSensorReading({ illuminance: 750 });'],
SensorReadingEvent: ['new SensorReadingEvent({ reading: new AmbientLightSensorReading({ illuminance: 750 }) });']
});
idl_array.test();

View file

@ -42,17 +42,8 @@ test(function() {
assert_true("initEvent" in ev)
})
test(function() {
var ev = Event("test")
assert_equals(ev.type, "test")
assert_equals(ev.target, null)
assert_equals(ev.currentTarget, null)
assert_equals(ev.eventPhase, Event.NONE)
assert_equals(ev.bubbles, false)
assert_equals(ev.cancelable, false)
assert_equals(ev.defaultPrevented, false)
assert_equals(ev.isTrusted, false)
assert_true(ev.timeStamp > 0)
assert_true("initEvent" in ev)
assert_throws(new TypeError(), function() { Event("test") },
'Calling Event constructor without "new" must throw');
})
test(function() {
var ev = new Event("I am an event", { bubbles: true, cancelable: false})

View file

@ -42,6 +42,7 @@ dictionary EventInit {
boolean cancelable = false;
};
[Constructor(DOMString type, optional CustomEventInit eventInitDict)/*,
Exposed=(Window,Worker)*/]
interface CustomEvent : Event {
@ -54,10 +55,11 @@ dictionary CustomEventInit : EventInit {
any detail = null;
};
//[Exposed=(Window,Worker)]
interface EventTarget {
void addEventListener(DOMString type, EventListener? callback, optional boolean capture = false);
void removeEventListener(DOMString type, EventListener? callback, optional boolean capture = false);
void addEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options);
void removeEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options);
boolean dispatchEvent(Event event);
};
@ -65,25 +67,40 @@ callback interface EventListener {
void handleEvent(Event event);
};
[NoInterfaceObject]
dictionary EventListenerOptions {
boolean capture;
boolean passive;
};
[NoInterfaceObject,
Exposed=Window]
interface NonElementParentNode {
Element? getElementById(DOMString elementId);
};
Document implements NonElementParentNode;
DocumentFragment implements NonElementParentNode;
[NoInterfaceObject]
[NoInterfaceObject,
Exposed=Window]
interface DocumentOrShadowRoot {
};
Document implements DocumentOrShadowRoot;
ShadowRoot implements DocumentOrShadowRoot;
[NoInterfaceObject,
Exposed=Window]
interface ParentNode {
[SameObject] readonly attribute HTMLCollection children;
readonly attribute Element? firstElementChild;
readonly attribute Element? lastElementChild;
readonly attribute unsigned long childElementCount;
[Unscopeable] void prepend((Node or DOMString)... nodes);
[Unscopeable] void append((Node or DOMString)... nodes);
[Unscopable] void prepend((Node or DOMString)... nodes);
[Unscopable] void append((Node or DOMString)... nodes);
[Unscopeable] Element? query(DOMString relativeSelectors);
[NewObject, Unscopeable] Elements queryAll(DOMString relativeSelectors);
Element? querySelector(DOMString selectors);
[NewObject] NodeList querySelectorAll(DOMString selectors);
};
@ -91,7 +108,9 @@ Document implements ParentNode;
DocumentFragment implements ParentNode;
Element implements ParentNode;
[NoInterfaceObject]
[NoInterfaceObject,
Exposed=Window]
interface NonDocumentTypeChildNode {
readonly attribute Element? previousElementSibling;
readonly attribute Element? nextElementSibling;
@ -99,37 +118,45 @@ interface NonDocumentTypeChildNode {
Element implements NonDocumentTypeChildNode;
CharacterData implements NonDocumentTypeChildNode;
[NoInterfaceObject]
[NoInterfaceObject,
Exposed=Window]
interface ChildNode {
[Unscopeable] void before((Node or DOMString)... nodes);
[Unscopeable] void after((Node or DOMString)... nodes);
[Unscopeable] void replaceWith((Node or DOMString)... nodes);
[Unscopeable] void remove();
[Unscopable] void before((Node or DOMString)... nodes);
[Unscopable] void after((Node or DOMString)... nodes);
[Unscopable] void replaceWith((Node or DOMString)... nodes);
[Unscopable] void remove();
};
DocumentType implements ChildNode;
Element implements ChildNode;
CharacterData implements ChildNode;
// XXX unrecognized tokens "class", "extends"
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=20020
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=23225
//class Elements extends Array {
// Element? query(DOMString relativeSelectors);
// Elements queryAll(DOMString relativeSelectors);
//};
[NoInterfaceObject,
Exposed=Window]
interface Slotable {
readonly attribute HTMLSlotElement? assignedSlot;
};
Element implements Slotable;
Text implements Slotable;
[Exposed=Window]
interface NodeList {
getter Node? item(unsigned long index);
readonly attribute unsigned long length;
// iterable<Node>;
};
[Exposed=Window, LegacyUnenumerableNamedProperties]
interface HTMLCollection {
readonly attribute unsigned long length;
getter Element? item(unsigned long index);
getter Element? namedItem(DOMString name);
};
[Constructor(MutationCallback callback)]
interface MutationObserver {
void observe(Node target, MutationObserverInit options);
@ -149,9 +176,11 @@ dictionary MutationObserverInit {
sequence<DOMString> attributeFilter;
};
[Exposed=Window]
interface MutationRecord {
readonly attribute DOMString type;
readonly attribute Node target;
[SameObject] readonly attribute Node target;
[SameObject] readonly attribute NodeList addedNodes;
[SameObject] readonly attribute NodeList removedNodes;
readonly attribute Node? previousSibling;
@ -161,6 +190,8 @@ interface MutationRecord {
readonly attribute DOMString? oldValue;
};
[Exposed=Window]
interface Node : EventTarget {
const unsigned short ELEMENT_NODE = 1;
const unsigned short ATTRIBUTE_NODE = 2; // historical
@ -177,8 +208,9 @@ interface Node : EventTarget {
readonly attribute unsigned short nodeType;
readonly attribute DOMString nodeName;
readonly attribute DOMString? baseURI;
readonly attribute DOMString baseURI;
readonly attribute boolean isConnected;
readonly attribute Document? ownerDocument;
readonly attribute Node rootNode;
readonly attribute Node? parentNode;
@ -195,7 +227,8 @@ interface Node : EventTarget {
void normalize();
[NewObject] Node cloneNode(optional boolean deep = false);
boolean isEqualNode(Node? node);
boolean isEqualNode(Node? otherNode);
boolean isSameNode(Node? otherNode); // historical alias of ===
const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01;
const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02;
@ -216,7 +249,9 @@ interface Node : EventTarget {
Node removeChild(Node child);
};
[Constructor]
[Constructor,
Exposed=Window]
interface Document : Node {
[SameObject] readonly attribute DOMImplementation implementation;
readonly attribute DOMString URL;
@ -224,18 +259,18 @@ interface Document : Node {
readonly attribute DOMString origin;
readonly attribute DOMString compatMode;
readonly attribute DOMString characterSet;
readonly attribute DOMString charset; // legacy alias of .characterSet
readonly attribute DOMString inputEncoding; // legacy alias of .characterSet
readonly attribute DOMString charset; // historical alias of .characterSet
readonly attribute DOMString inputEncoding; // historical alias of .characterSet
readonly attribute DOMString contentType;
readonly attribute DocumentType? doctype;
readonly attribute Element? documentElement;
HTMLCollection getElementsByTagName(DOMString localName);
HTMLCollection getElementsByTagName(DOMString qualifiedName);
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
HTMLCollection getElementsByClassName(DOMString classNames);
[NewObject] Element createElement(DOMString localName);
[NewObject] Element createElementNS(DOMString? namespace, DOMString qualifiedName);
[NewObject] Element createElement(DOMString localName, optional ElementCreationOptions options);
[NewObject] Element createElementNS(DOMString? namespace, DOMString qualifiedName, optional ElementCreationOptions options);
[NewObject] DocumentFragment createDocumentFragment();
[NewObject] Text createTextNode(DOMString data);
[NewObject] Comment createComment(DOMString data);
@ -245,7 +280,7 @@ interface Document : Node {
Node adoptNode(Node node);
[NewObject] Attr createAttribute(DOMString localName);
[NewObject] Attr createAttributeNS(DOMString? namespace, DOMString name);
[NewObject] Attr createAttributeNS(DOMString? namespace, DOMString qualifiedName);
[NewObject] Event createEvent(DOMString interface);
@ -256,8 +291,15 @@ interface Document : Node {
[NewObject] TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
};
[Exposed=Window]
interface XMLDocument : Document {};
dictionary ElementCreationOptions {
DOMString is;
};
[Exposed=Window]
interface DOMImplementation {
[NewObject] DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, DOMString systemId);
[NewObject] XMLDocument createDocument(DOMString? namespace, [TreatNullAs=EmptyString] DOMString qualifiedName, optional DocumentType? doctype = null);
@ -266,16 +308,31 @@ interface DOMImplementation {
boolean hasFeature(); // useless; always returns true
};
[Constructor]
interface DocumentFragment : Node {
};
[Exposed=Window]
interface DocumentType : Node {
readonly attribute DOMString name;
readonly attribute DOMString publicId;
readonly attribute DOMString systemId;
};
[Constructor,
Exposed=Window]
interface DocumentFragment : Node {
};
[Exposed=Window]
interface ShadowRoot : DocumentFragment {
readonly attribute ShadowRootMode mode;
readonly attribute Element host;
};
enum ShadowRootMode { "open", "closed" };
[Exposed=Window]
interface Element : Node {
readonly attribute DOMString? namespaceURI;
readonly attribute DOMString? prefix;
@ -285,29 +342,34 @@ interface Element : Node {
attribute DOMString id;
attribute DOMString className;
[SameObject, PutForwards=value] readonly attribute DOMTokenList classList;
attribute DOMString slot;
boolean hasAttributes();
[SameObject] readonly attribute NamedNodeMap attributes;
sequence<DOMString> getAttributeNames();
DOMString? getAttribute(DOMString name);
DOMString? getAttribute(DOMString qualifiedName);
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
void setAttribute(DOMString name, DOMString value);
void setAttributeNS(DOMString? namespace, DOMString name, DOMString value);
void removeAttribute(DOMString name);
void setAttribute(DOMString qualifiedName, DOMString value);
void setAttributeNS(DOMString? namespace, DOMString qualifiedName, DOMString value);
void removeAttribute(DOMString qualifiedName);
void removeAttributeNS(DOMString? namespace, DOMString localName);
boolean hasAttribute(DOMString name);
boolean hasAttribute(DOMString qualifiedName);
boolean hasAttributeNS(DOMString? namespace, DOMString localName);
Attr? getAttributeNode(DOMString name);
Attr? getAttributeNode(DOMString qualifiedName);
Attr? getAttributeNodeNS(DOMString? namespace, DOMString localName);
Attr? setAttributeNode(Attr attr);
Attr? setAttributeNodeNS(Attr attr);
Attr removeAttributeNode(Attr attr);
ShadowRoot attachShadow(ShadowRootInit init);
readonly attribute ShadowRoot? shadowRoot;
Element? closest(DOMString selectors);
boolean matches(DOMString selectors);
boolean webkitMatchesSelector(DOMString selectors); // historical alias of .matches
HTMLCollection getElementsByTagName(DOMString localName);
HTMLCollection getElementsByTagName(DOMString qualifiedName);
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
HTMLCollection getElementsByClassName(DOMString classNames);
@ -315,31 +377,41 @@ interface Element : Node {
void insertAdjacentText(DOMString where, DOMString data); // historical
};
dictionary ShadowRootInit {
// required ShadowRootMode mode;
};
[Exposed=Window, LegacyUnenumerableNamedProperties]
interface NamedNodeMap {
readonly attribute unsigned long length;
getter Attr? item(unsigned long index);
getter Attr? getNamedItem(DOMString name);
getter Attr? getNamedItem(DOMString qualifiedName);
Attr? getNamedItemNS(DOMString? namespace, DOMString localName);
Attr? setNamedItem(Attr attr);
Attr? setNamedItemNS(Attr attr);
Attr removeNamedItem(DOMString name);
Attr removeNamedItem(DOMString qualifiedName);
Attr removeNamedItemNS(DOMString? namespace, DOMString localName);
};
[Exposed=Window]
interface Attr {
readonly attribute DOMString? namespaceURI;
readonly attribute DOMString? prefix;
readonly attribute DOMString localName;
readonly attribute DOMString name;
readonly attribute DOMString nodeName; // historical alias of .name
attribute DOMString value;
attribute DOMString nodeValue; // legacy alias of .value
attribute DOMString textContent; // legacy alias of .value
[TreatNullAs=EmptyString] attribute DOMString nodeValue; // historical alias of .value
[TreatNullAs=EmptyString] attribute DOMString textContent; // historical alias of .value
readonly attribute Element? ownerElement;
readonly attribute boolean specified; // useless; always returns true
};
[Exposed=Window]
interface CharacterData : Node {
[TreatNullAs=EmptyString] attribute DOMString data;
readonly attribute unsigned long length;
@ -350,21 +422,27 @@ interface CharacterData : Node {
void replaceData(unsigned long offset, unsigned long count, DOMString data);
};
[Constructor(optional DOMString data = "")]
[Constructor(optional DOMString data = ""),
Exposed=Window]
interface Text : CharacterData {
[NewObject] Text splitText(unsigned long offset);
readonly attribute DOMString wholeText;
};
[Exposed=Window]
interface ProcessingInstruction : CharacterData {
readonly attribute DOMString target;
};
[Constructor(optional DOMString data = "")]
[Constructor(optional DOMString data = ""),
Exposed=Window]
interface Comment : CharacterData {
};
[Constructor]
[Constructor,
Exposed=Window]
interface Range {
readonly attribute Node startContainer;
readonly attribute unsigned long startOffset;
@ -406,6 +484,8 @@ interface Range {
stringifier;
};
[Exposed=Window]
interface NodeIterator {
[SameObject] readonly attribute Node root;
readonly attribute Node referenceNode;
@ -419,6 +499,8 @@ interface NodeIterator {
void detach();
};
[Exposed=Window]
interface TreeWalker {
[SameObject] readonly attribute Node root;
readonly attribute unsigned long whatToShow;
@ -434,6 +516,7 @@ interface TreeWalker {
Node? nextNode();
};
[Exposed=Window]
callback interface NodeFilter {
// Constants for acceptNode()
const unsigned short FILTER_ACCEPT = 1;
@ -458,6 +541,7 @@ callback interface NodeFilter {
unsigned short acceptNode(Node node);
};
interface DOMTokenList {
readonly attribute unsigned long length;
getter DOMString? item(unsigned long index);

View file

@ -11,6 +11,10 @@
<script src="Document-createElementNS.js"></script>
<div id="log"></div>
<script>
var htmlNamespace = "http://www.w3.org/1999/xhtml"
var svgNamespace = "http://www.w3.org/2000/svg"
var mathMLNamespace = "http://www.w3.org/1998/Math/MathML"
test(function() {
var tests = createElementNS_tests.map(function(t) {
return [t[0], t[1], null, t[2]]
@ -57,6 +61,21 @@ test(function() {
[null, "foo", document.implementation.createDocumentType("foo", "", ""), null],
["foo", null, document.implementation.createDocumentType("foo", "", ""), null],
["foo", "bar", document.implementation.createDocumentType("foo", "", ""), null],
[htmlNamespace, "", null, null],
[svgNamespace, "", null, null],
[mathMLNamespace, "", null, null],
[null, "html", null, null],
[null, "svg", null, null],
[null, "math", null, null],
[null, "", document.implementation.createDocumentType("html",
"-//W3C//DTD XHTML 1.0 Transitional//EN",
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd")],
[null, "", document.implementation.createDocumentType("svg",
"-//W3C//DTD SVG 1.1//EN",
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd")],
[null, "", document.implementation.createDocumentType("math",
"-//W3C//DTD MathML 2.0//EN",
"http://www.w3.org/Math/DTD/mathml2/mathml2.dtd")],
])
tests.forEach(function(t, i) {
@ -70,6 +89,7 @@ test(function() {
assert_equals(doc.nodeType, doc.DOCUMENT_NODE)
assert_equals(doc.nodeName, "#document")
assert_equals(doc.nodeValue, null)
assert_equals(Object.getPrototypeOf(doc), XMLDocument.prototype)
var omitRootElement = qualifiedName === null || String(qualifiedName) === ""
if (omitRootElement) {
assert_equals(doc.documentElement, null)
@ -103,7 +123,9 @@ test(function() {
var doc = document.implementation.createDocument(namespace, qualifiedName, doctype)
assert_equals(doc.compatMode, "CSS1Compat")
assert_equals(doc.characterSet, "UTF-8")
assert_equals(doc.contentType, "application/xml")
assert_equals(doc.contentType, namespace == htmlNamespace ? "text/html"
: namespace == svgNamespace ? "image/svg+xml"
: "application/xml")
assert_equals(doc.URL, "about:blank")
assert_equals(doc.documentURI, "about:blank")
assert_equals(doc.createElement("DIV").localName, "DIV");

View file

@ -13,8 +13,8 @@
*/
/**
* Test that an element created using the Document object doc has the HTML
* namespace.
* Test that an element created using the Document object doc has the namespace
* that would be expected for the given contentType.
*/
function testDoc(doc, contentType) {
if (doc.contentType !== undefined) {
@ -23,7 +23,11 @@ function testDoc(doc, contentType) {
"Wrong MIME type -- incorrect server config?");
}
assert_equals(doc.createElement("x").namespaceURI, "http://www.w3.org/1999/xhtml");
var expectedNamespace = contentType == "text/html" ||
contentType == "application/xhtml+xml"
? "http://www.w3.org/1999/xhtml" : null;
assert_equals(doc.createElement("x").namespaceURI, expectedNamespace);
}
// First test various objects we create in JS
@ -39,11 +43,11 @@ test(function() {
}, "Created element's namespace in created XML document");
test(function() {
testDoc(document.implementation.createDocument("http://www.w3.org/1999/xhtml", "html", null),
"application/xml");
"application/xhtml+xml");
}, "Created element's namespace in created XHTML document");
test(function() {
testDoc(document.implementation.createDocument("http://www.w3.org/2000/svg", "svg", null),
"application/xml");
"image/svg+xml");
}, "Created element's namespace in created SVG document");
test(function() {
testDoc(document.implementation.createDocument("http://www.w3.org/1998/Math/MathML", "math", null),

View file

@ -39,7 +39,7 @@ for (var alias in aliases) {
testAlias(alias.toLowerCase(), iface);
testAlias(alias.toUpperCase(), iface);
if (!alias.endsWith("s")) {
if (alias[alias.length - 1] != "s") {
var plural = alias + "s";
if (!(plural in aliases)) {
test(function () {
@ -66,37 +66,28 @@ test(function() {
}, "Should throw NOT_SUPPORTED_ERR for unrecognized arguments");
/*
The following are event interfaces which do actually exist, but must still
throw since they're absent from the table in the spec
for document.createEvent().
This list is not exhaustive.
*/
* The following are event interfaces which do actually exist, but must still
* throw since they're absent from the table in the spec for
* document.createEvent(). This list is not exhaustive, but includes all
* interfaces that it is known some UA does or did not throw for.
*/
var someNonCreateableEvents = [
"AnimationEvent",
"AnimationPlayerEvent",
"ApplicationCacheErrorEvent",
"AudioProcessingEvent",
"AutocompleteErrorEvent",
"BeforeInstallPromptEvent",
"BeforeUnloadEvent",
"BlobEvent",
"ClipboardEvent",
"CloseEvent",
"CompositionEvent",
"CommandEvent",
"DataContainerEvent",
"DeviceLightEvent",
"DeviceMotionEvent",
"DeviceOrientationEvent",
"DragEvent",
"ErrorEvent",
"ExtendableEvent",
"ExtendableMessageEvent",
"FetchEvent",
"FocusEvent",
"FontFaceSetLoadEvent",
"GamepadEvent",
"GeofencingEvent",
"HashChangeEvent",
"IDBVersionChangeEvent",
"InstallEvent",
"KeyEvent",
"MIDIConnectionEvent",
@ -107,16 +98,17 @@ var someNonCreateableEvents = [
"MediaQueryListEvent",
"MediaStreamEvent",
"MediaStreamTrackEvent",
"MouseScrollEvent",
"MutationEvent",
"NotificationEvent",
"NotifyPaintEvent",
"OfflineAudioCompletionEvent",
"OrientationEvent",
"PageTransitionEvent",
"PageTransition", // Yes, with no "Event"
"PointerEvent",
"PopStateEvent",
"PopUpEvent",
"PresentationConnectionAvailableEvent",
"PresentationConnectionCloseEvent",
"ProgressEvent",
"PromiseRejectionEvent",
"PushEvent",
"RTCDTMFToneChangeEvent",
@ -125,34 +117,37 @@ var someNonCreateableEvents = [
"RelatedEvent",
"ResourceProgressEvent",
"SVGEvent",
"SVGZoomEvent",
"ScrollAreaEvent",
"SecurityPolicyViolationEvent",
"ServicePortConnectEvent",
"ServiceWorkerMessageEvent",
"SimpleGestureEvent",
"SpeechRecognitionError",
"SpeechRecognitionEvent",
"SpeechSynthesisEvent",
"StorageEvent",
"SyncEvent",
"TextEvent",
"TrackEvent",
"TransitionEvent",
"WebGLContextEvent",
"TimeEvent",
"WebKitAnimationEvent",
"WebKitTransitionEvent",
"WheelEvent"
"XULCommandEvent",
];
someNonCreateableEvents.forEach(function (eventInterface) {
test(function () {
assert_throws("NOT_SUPPORTED_ERR", function () {
var evt = document.createEvent(eventInterface);
});
}, 'Should throw NOT_SUPPORTED_ERR for non-legacy event interface "' + eventInterface + '"');
// SVGEvents is allowed, but not SVGEvent. Make sure we only test if it's
// not whitelisted.
if (!(eventInterface in aliases)) {
test(function () {
assert_throws("NOT_SUPPORTED_ERR", function () {
var evt = document.createEvent(eventInterface);
});
}, 'Should throw NOT_SUPPORTED_ERR for non-legacy event interface "' + eventInterface + '"');
}
test(function () {
assert_throws("NOT_SUPPORTED_ERR", function () {
var evt = document.createEvent(eventInterface + "s");
});
}, 'Should throw NOT_SUPPORTED_ERR for pluralized non-legacy event interface "' + eventInterface + '"');
if (!(eventInterface + "s" in aliases)) {
test(function () {
assert_throws("NOT_SUPPORTED_ERR", function () {
var evt = document.createEvent(eventInterface + "s");
});
}, 'Should throw NOT_SUPPORTED_ERR for pluralized non-legacy event interface "' + eventInterface + 's"');
}
});
</script>

View file

@ -1,13 +1,36 @@
var aliases = {
"AnimationEvent": "AnimationEvent",
"BeforeUnloadEvent": "BeforeUnloadEvent",
"CloseEvent": "CloseEvent",
"CompositionEvent": "CompositionEvent",
"CustomEvent": "CustomEvent",
"DeviceMotionEvent": "DeviceMotionEvent",
"DeviceOrientationEvent": "DeviceOrientationEvent",
"DragEvent": "DragEvent",
"ErrorEvent": "ErrorEvent",
"Event": "Event",
"Events": "Event",
"FocusEvent": "FocusEvent",
"HashChangeEvent": "HashChangeEvent",
"HTMLEvents": "Event",
"IDBVersionChangeEvent": "IDBVersionChangeEvent",
"KeyboardEvent": "KeyboardEvent",
"MessageEvent": "MessageEvent",
"MouseEvent": "MouseEvent",
"MouseEvents": "MouseEvent",
"PageTransitionEvent": "PageTransitionEvent",
"PopStateEvent": "PopStateEvent",
"ProgressEvent": "ProgressEvent",
"StorageEvent": "StorageEvent",
"SVGEvents": "Event",
"SVGZoomEvent": "SVGZoomEvent",
"SVGZoomEvents": "SVGZoomEvent",
"TextEvent": "CompositionEvent",
"TouchEvent": "TouchEvent",
"TrackEvent": "TrackEvent",
"TransitionEvent": "TransitionEvent",
"UIEvent": "UIEvent",
"UIEvents": "UIEvent"
"UIEvents": "UIEvent",
"WebGLContextEvent": "WebGLContextEvent",
"WheelEvent": "WheelEvent",
};

View file

@ -1,37 +0,0 @@
<!--
try {
var source = new EventSource("../resources/message.py")
source.addEventListener("message", listener, false)
function listener(e) {
postMessage([true, e.data])
this.close()
}
} catch(e) {
postMessage([false, String(e)])
}
/*-->
<!DOCTYPE html>
<html>
<head>
<title>dedicated worker - EventSource: addEventListener()</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
<script>
var test = async_test()
test.step(function() {
var worker = new Worker('#')
worker.onmessage = function(e) {
test.step(function() {
assert_true(e.data[0], e.data[1])
assert_equals(e.data[1], 'data', 'e.data')
})
test.done()
}
})
</script>
</body>
</html>
<!--*/ //-->

View file

@ -0,0 +1,11 @@
importScripts("/resources/testharness.js");
async_test(function() {
var source = new EventSource("../resources/message.py")
source.addEventListener("message", this.step_func_done(function(e) {
assert_equals(e.data, 'data');
source.close();
}), false)
}, "dedicated worker - EventSource: addEventListener()");
done();

View file

@ -0,0 +1,4 @@
@zqzhang
@dontcallmedom
@tobie
@riju

View file

@ -0,0 +1,86 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Generic Sensor IDL tests</title>
<link rel="author" title="Tobie Langel" href="http://www.codespeaks.com">
<link rel="help" href="http://www.w3.org/TR/generic-sensor/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
<style>
pre {
display: none;
}
</style>
<div id="log"></div>
<pre id="idl">
interface Event {
};
interface Error {
};
dictionary EventInit {
};
interface Sensor : EventTarget {
readonly attribute SensorState state;
readonly attribute SensorReading? reading;
void start();
void stop();
attribute EventHandler onchange;
attribute EventHandler onstatechange;
attribute EventHandler onerror;
};
dictionary SensorOptions {
double? frequency;
};
enum SensorState {
"idle",
"activating",
"active",
"errored"
};
interface SensorReading {
readonly attribute DOMHighResTimeStamp timeStamp;
};
[Constructor(DOMString type, SensorReadingEventInit eventInitDict)]
interface SensorReadingEvent : Event {
readonly attribute SensorReading reading;
};
dictionary SensorReadingEventInit : EventInit {
SensorReading reading;
};
</pre>
<pre id="generic-idl">
[Constructor(DOMString type, SensorErrorEventInit errorEventInitDict)]
interface SensorErrorEvent : Event {
readonly attribute Error error;
};
dictionary SensorErrorEventInit : EventInit {
Error error;
};
</pre>
<script>
(function() {
"use strict";
var idl_array = new IdlArray();
idl_array.add_untested_idls(document.getElementById('idl').textContent);
idl_array.add_idls(document.getElementById('generic-idl').textContent);
idl_array.add_objects({
SensorErrorEvent: ['new SensorErrorEvent({ error: new TypeError("Boom!") });']
});
idl_array.test();
})();
</script>

View file

@ -0,0 +1,4 @@
<!doctype html>
<meta charset=utf-8>
<title>Canvas fallback content</title>
<p>The word "FAIL" should not be visible below this line.

View file

@ -0,0 +1,22 @@
<!doctype html>
<meta charset=utf-8>
<title>Canvas fallback content</title>
<link rel=match href=canvas-fallback-ref.html>
<style>
#canvas2 {
display: inline;
}
#canvas3 {
display: block;
}
#canvas4 {
display: table;
}
</style>
<p>The word "FAIL" should not be visible below this line.
<p><canvas id=canvas1>FAIL</canvas>
<p><canvas id=canvas2>FAIL</canvas>
<p><canvas id=canvas3>FAIL</canvas>
<p><canvas id=canvas4>FAIL</canvas>

View file

@ -40,7 +40,7 @@
assert_true(c1_click_fired, "input event should fire after click event");
assert_false(c1_change_fired, "input event should fire before change event");
assert_true(e.bubbles, "event should bubble");
assert_false(e.isTrusted, "click()-initiated event should be trusted");
assert_false(e.isTrusted, "click()-initiated event should not be trusted");
assert_false(e.cancelable, "event should not be cancelable");
assert_true(checkbox1.checked, "checkbox is checked");
assert_false(checkbox1.indeterminate, "checkbox is not indeterminate");
@ -51,7 +51,7 @@
assert_true(c1_click_fired, "change event should fire after click event");
assert_true(c1_input_fired, "change event should fire after input event");
assert_true(e.bubbles, "event should bubble")
assert_false(e.isTrusted, "click()-initiated event should be trusted");
assert_false(e.isTrusted, "click()-initiated event should not be trusted");
assert_false(e.cancelable, "event should not be cancelable");
assert_true(checkbox1.checked, "checkbox is checked");
assert_false(checkbox1.indeterminate, "checkbox is not indeterminate");

View file

@ -34,10 +34,13 @@
<input type=checkbox id=checkbox1 checked>
<input type=checkbox id=checkbox2>
<input type=checkbox id=checkbox3 default>
<input type=radio name=radios id=radio1 checked>
<input type=radio name=radios id=radio2>
<input type=radio name=radios id=radio3 default>
<select id=select1>
<optgroup label="options" id=optgroup1>
<option value="option1" id=option1 selected>option1
<option value="option1" id=option1>option1
<option value="option2" id=option2 selected>option2
</select>
<dialog id="dialog">
<input type=submit id=input8>
@ -53,9 +56,9 @@
<script>
testSelector(":default", ["button2", "button4", "input3", "input5", "input7", "checkbox1", "option1", "button6", "button8"], "':default' matches <button>s that are their form's default button, <input>s of type submit/image that are their form's default button, checked <input>s and selected <option>s");
testSelector(":default", ["button2", "button4", "input3", "input5", "input7", "checkbox1", "radio1", "option2", "button6", "button8"], "':default' matches <button>s that are their form's default button, <input>s of type submit/image that are their form's default button, checked <input>s and selected <option>s");
document.getElementById("button1").type = "submit"; // change the form's default button
testSelector(":default", ["button1", "button4", "input3", "input5", "input7", "checkbox1", "option1", "button6", "button8"], "':default' matches dynamically changed form's default buttons");
testSelector(":default", ["button1", "button4", "input3", "input5", "input7", "checkbox1", "radio1", "option2", "button6", "button8"], "':default' matches dynamically changed form's default buttons");
</script>

View file

@ -1,8 +1,10 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Selector: pseudo-classes (:in-range, :out-of-range)</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org" id=link1>
<link rel=help href="https://html.spec.whatwg.org/multipage/#pseudo-classes" id=link2>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org" id="link1">
<link rel="author" title="Chris Rebert" href="http://chrisrebert.com" id="link2">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#selector-in-range" id="link3">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#selector-out-of-range" id="link4">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="utils.js"></script>
@ -11,17 +13,72 @@
<input type=number value=0 min=0 max=10 id=number2 disabled>
<input type=number value=0 min=1 max=10 id=number3>
<input type=number value=11 min=0 max=10 id=number4>
<input type=number value=0 min=0 max=10 id=number5 readonly>
<input type="date" min="2005-10-10" max="2020-10-10" value="2010-10-10" id="datein">
<input type="date" min="2010-10-10" max="2020-10-10" value="2005-10-10" id="dateunder">
<input type="date" min="2010-10-10" max="2020-10-10" value="2030-10-10" id="dateover">
<input type="time" min="01:00:00" max="05:00:00" value="02:00:00" id="timein">
<input type="time" min="02:00:00" max="05:00:00" value="01:00:00" id="timeunder">
<input type="time" min="02:00:00" max="05:00:00" value="07:00:00" id="timeover">
<input type="week" min="2016-W05" max="2016-W10" value="2016-W07" id="weekin">
<input type="week" min="2016-W05" max="2016-W10" value="2016-W02" id="weekunder">
<input type="week" min="2016-W05" max="2016-W10" value="2016-W26" id="weekover">
<input type="month" min="2000-04" max="2000-09" value="2000-06" id="monthin">
<input type="month" min="2000-04" max="2000-09" value="2000-02" id="monthunder">
<input type="month" min="2000-04" max="2000-09" value="2000-11" id="monthover">
<input type="datetime-local" min="2008-03-12T23:59:59" max="2015-02-13T23:59:59" value="2012-11-28T23:59:59" id="datetimelocalin">
<input type="datetime-local" min="2008-03-12T23:59:59" max="2015-02-13T23:59:59" value="2008-03-01T23:59:59" id="datetimelocalunder">
<input type="datetime-local" min="2008-03-12T23:59:59" max="2015-02-13T23:59:59" value="2016-01-01T23:59:59" id="datetimelocalover">
<!-- None of the following have range limitations since they have neither min nor max attributes -->
<input type="number" value="0" id="numbernolimit">
<input type="date" value="2010-10-10" id="datenolimit">
<input type="time" value="02:00:00" id="timenolimit">
<input type="week" value="2016-W07" id="weeknolimit">
<input type="month" value="2000-06" id="monthnolimit">
<input type="datetime-local" value="2012-11-28T23:59:59" id="datetimelocalnolimit">
<!-- range inputs have default minimum of 0 and default maximum of 100 -->
<input type="range" value="50" id="range0">
<!-- range input's value gets immediately clamped to the nearest boundary point -->
<input type="range" min="2" max="7" value="5" id="range1">
<input type="range" min="2" max="7" value="1" id="range2">
<input type="range" min="2" max="7" value="9" id="range3">
<!-- None of the following input types can have range limitations -->
<input min="1" value="0" type="text">
<input min="1" value="0" type="search">
<input min="1" value="0" type="url">
<input min="1" value="0" type="tel">
<input min="1" value="0" type="email">
<input min="1" value="0" type="password">
<input min="1" value="#000000" type="color">
<input min="1" value="0" type="checkbox">
<input min="1" value="0" type="radio">
<input min="1" value="0" type="file">
<input min="1" value="0" type="submit">
<input min="1" value="0" type="image">
<!-- The following types are also barred from constraint validation -->
<input min="1" value="0" type="hidden">
<input min="1" value="0" type="button">
<input min="1" value="0" type="reset">
<script>
testSelector(":in-range", ["number1"], "':in-range' matches all elements that are candidates for constraint validation, have range limitations, and that are neither suffering from an underflow nor suffering from an overflow");
testSelector(":in-range", ["number1", "datein", "timein", "weekin", "monthin", "datetimelocalin", "range0", "range1", "range2", "range3"], "':in-range' matches all elements that are candidates for constraint validation, have range limitations, and that are neither suffering from an underflow nor suffering from an overflow");
testSelector(":out-of-range", ["number3", "number4"], "':out-of-range' matches all elements that are candidates for constraint validation, have range limitations, and that are either suffering from an underflow or suffering from an overflow");
testSelector(":out-of-range", ["number3", "number4", "dateunder", "dateover", "timeunder", "timeover", "weekunder", "weekover", "monthunder", "monthover", "datetimelocalunder", "datetimelocalover"], "':out-of-range' matches all elements that are candidates for constraint validation, have range limitations, and that are either suffering from an underflow or suffering from an overflow");
document.getElementById("number1").value = -10;
testSelector(":in-range", [], "':in-range' update number1's value < min");
testSelector(":out-of-range", ["number1", "number3", "number4"], "':out-of-range' update number1's value < min");
testSelector(":in-range", ["datein", "timein", "weekin", "monthin", "datetimelocalin", "range0", "range1", "range2", "range3"], "':in-range' update number1's value < min");
testSelector(":out-of-range", ["number1", "number3", "number4", "dateunder", "dateover", "timeunder", "timeover", "weekunder", "weekover", "monthunder", "monthover", "datetimelocalunder", "datetimelocalover"], "':out-of-range' update number1's value < min");
document.getElementById("number3").min = 0;
testSelector(":in-range", ["number3"], "':in-range' update number3's min < value");
testSelector(":out-of-range", ["number1", "number4"], "':out-of-range' update number3's min < value");
testSelector(":in-range", ["number3", "datein", "timein", "weekin", "monthin", "datetimelocalin", "range0", "range1", "range2", "range3"], "':in-range' update number3's min < value");
testSelector(":out-of-range", ["number1", "number4", "dateunder", "dateover", "timeunder", "timeover", "weekunder", "weekover", "monthunder", "monthover", "datetimelocalunder", "datetimelocalover"], "':out-of-range' update number3's min < value");
</script>

View file

@ -7,6 +7,20 @@
<script src="utils.js"></script>
<div id="log"></div>
<div id=set0>
<!-- The readonly attribute does not apply to the following input types -->
<input id=checkbox1 type=checkbox>
<input id=hidden1 type=hidden value=abc>
<input id=range1 type=range>
<input id=color1 type=color>
<input id=radio1 type=radio>
<input id=file1 type=file>
<input id=submit1 type=submit>
<input id=image1 type=image>
<input id=button1 type=button value="Button">
<input id=reset1 type=reset>
</div>
<div id=set1>
<input id=input1>
<input id=input2 readonly>
@ -31,6 +45,10 @@
</div>
<script>
testSelector("#set0 :read-write", [], "The :read-write pseudo-class must not match input elements to which the readonly attribute does not apply");
testSelector("#set0 :read-only", ["checkbox1", "hidden1", "range1", "color1", "radio1", "file1", "submit1", "image1", "button1", "reset1"], "The :read-only pseudo-class must match input elements to which the readonly attribute does not apply");
testSelector("#set1 :read-write", ["input1"], "The :read-write pseudo-class must match input elements to which the readonly attribute applies, and that are mutable");
testSelector("#set1 :read-only", ["input2"], "The :read-only pseudo-class must not match input elements to which the readonly attribute applies, and that are mutable");

View file

@ -97,6 +97,16 @@ function awaitNCallbacks(n, cb, ctx) {
};
}
var fround = (function(){
if (Math.fround) return Math.fround;
var arr = new Float32Array(1);
return function fround(n) {
arr[0] = n;
return arr[0];
};
})();
/// IdlArray ///
// Entry point
self.IdlArray = function()
@ -457,21 +467,44 @@ IdlArray.prototype.assert_type_is = function(value, type)
return;
case "float":
case "double":
assert_equals(typeof value, "number");
assert_equals(value, fround(value), "float rounded to 32-bit float should be itself");
assert_not_equals(value, Infinity);
assert_not_equals(value, -Infinity);
assert_not_equals(value, NaN);
return;
case "DOMHighResTimeStamp":
case "double":
assert_equals(typeof value, "number");
assert_not_equals(value, Infinity);
assert_not_equals(value, -Infinity);
assert_not_equals(value, NaN);
return;
case "unrestricted float":
assert_equals(typeof value, "number");
assert_equals(value, fround(value), "unrestricted float rounded to 32-bit float should be itself");
return;
case "unrestricted double":
// TODO: distinguish these cases
assert_equals(typeof value, "number");
return;
case "DOMString":
case "ByteString":
case "USVString":
// TODO: https://github.com/w3c/testharness.js/issues/92
assert_equals(typeof value, "string");
return;
case "ByteString":
assert_equals(typeof value, "string");
assert_regexp_match(value, /^[\x00-\x7F]*$/);
return;
case "USVString":
assert_equals(typeof value, "string");
assert_regexp_match(value, /^([\x00-\ud7ff\ue000-\uffff]|[\ud800-\udbff][\udc00-\udfff])*$/);
return;
case "object":
assert_true(typeof value == "object" || typeof value == "function", "wrong type: not object or function");
return;

View file

@ -1,4 +1,4 @@
## Introdution ##
## Introduction ##
testharness.js provides a framework for writing low-level tests of
browser functionality in javascript. It provides a convenient API for

View file

@ -697,10 +697,17 @@ policies and contribution forms [3].
// instanceof doesn't work if the node is from another window (like an
// iframe's contentWindow):
// http://www.w3.org/Bugs/Public/show_bug.cgi?id=12295
if ("nodeType" in object &&
"nodeName" in object &&
"nodeValue" in object &&
"childNodes" in object) {
try {
var has_node_properties = ("nodeType" in object &&
"nodeName" in object &&
"nodeValue" in object &&
"childNodes" in object);
} catch (e) {
// We're probably cross-origin, which means we aren't a node
return false;
}
if (has_node_properties) {
try {
object.nodeType;
} catch (e) {
@ -713,6 +720,44 @@ policies and contribution forms [3].
return false;
}
var replacements = {
"0": "0",
"1": "x01",
"2": "x02",
"3": "x03",
"4": "x04",
"5": "x05",
"6": "x06",
"7": "x07",
"8": "b",
"9": "t",
"10": "n",
"11": "v",
"12": "f",
"13": "r",
"14": "x0e",
"15": "x0f",
"16": "x10",
"17": "x11",
"18": "x12",
"19": "x13",
"20": "x14",
"21": "x15",
"22": "x16",
"23": "x17",
"24": "x18",
"25": "x19",
"26": "x1a",
"27": "x1b",
"28": "x1c",
"29": "x1d",
"30": "x1e",
"31": "x1f",
"0xfffd": "ufffd",
"0xfffe": "ufffe",
"0xffff": "uffff",
};
/*
* Convert a value to a nice, human-readable string
*/
@ -734,43 +779,9 @@ policies and contribution forms [3].
switch (typeof val) {
case "string":
val = val.replace("\\", "\\\\");
for (var i = 0; i < 32; i++) {
var replace = "\\";
switch (i) {
case 0: replace += "0"; break;
case 1: replace += "x01"; break;
case 2: replace += "x02"; break;
case 3: replace += "x03"; break;
case 4: replace += "x04"; break;
case 5: replace += "x05"; break;
case 6: replace += "x06"; break;
case 7: replace += "x07"; break;
case 8: replace += "b"; break;
case 9: replace += "t"; break;
case 10: replace += "n"; break;
case 11: replace += "v"; break;
case 12: replace += "f"; break;
case 13: replace += "r"; break;
case 14: replace += "x0e"; break;
case 15: replace += "x0f"; break;
case 16: replace += "x10"; break;
case 17: replace += "x11"; break;
case 18: replace += "x12"; break;
case 19: replace += "x13"; break;
case 20: replace += "x14"; break;
case 21: replace += "x15"; break;
case 22: replace += "x16"; break;
case 23: replace += "x17"; break;
case 24: replace += "x18"; break;
case 25: replace += "x19"; break;
case 26: replace += "x1a"; break;
case 27: replace += "x1b"; break;
case 28: replace += "x1c"; break;
case 29: replace += "x1d"; break;
case 30: replace += "x1e"; break;
case 31: replace += "x1f"; break;
}
val = val.replace(RegExp(String.fromCharCode(i), "g"), replace);
for (var p in replacements) {
var replace = "\\" + replacements[p];
val = val.replace(RegExp(String.fromCharCode(p), "g"), replace);
}
return '"' + val.replace(/"/g, '\\"') + '"';
case "boolean":
@ -818,7 +829,12 @@ policies and contribution forms [3].
/* falls through */
default:
return typeof val + ' "' + truncate(String(val), 60) + '"';
try {
return typeof val + ' "' + truncate(String(val), 60) + '"';
} catch(e) {
return ("[stringifying object threw " + String(e) +
" with type " + String(typeof e) + "]");
}
}
}
expose(format_value, "format_value");
@ -1438,7 +1454,7 @@ policies and contribution forms [3].
var args = Array.prototype.slice.call(arguments, 2);
return setTimeout(this.step_func(function() {
return f.apply(test_this, args);
}, timeout * tests.timeout_multiplier));
}), timeout * tests.timeout_multiplier);
}
Test.prototype.add_cleanup = function(callback) {

View file

@ -115,7 +115,7 @@ function createTestMediaPlayer(d) {
'</div>' +
'</div>';
var playerShadowRoot = d.querySelector('#player-shadow-host').createShadowRoot();
var playerShadowRoot = d.querySelector('#player-shadow-host').attachShadow({mode: 'open'});
playerShadowRoot.innerHTML = '' +
'<div id="controls">' +
'<button class="play-button">PLAY</button>' +
@ -131,10 +131,10 @@ function createTestMediaPlayer(d) {
'</div>' +
'</div>';
var timeLineShadowRoot = playerShadowRoot.querySelector('#timeline-shadow-host').createShadowRoot();
var timeLineShadowRoot = playerShadowRoot.querySelector('#timeline-shadow-host').attachShadow({mode: 'open'});
timeLineShadowRoot.innerHTML = '<div class="slider-thumb" id="timeline-slider-thumb"></div>';
var volumeShadowRoot = playerShadowRoot.querySelector('#volume-shadow-host').createShadowRoot();
var volumeShadowRoot = playerShadowRoot.querySelector('#volume-shadow-host').attachShadow({mode: 'open'});
volumeShadowRoot.innerHTML = '<div class="slider-thumb" id="volume-slider-thumb"></div>';
return {

View file

@ -13,7 +13,7 @@ policies and contribution forms [3].
<title>Shadow DOM Test: A_10_02_02_01</title>
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#shadow-aware-methods">
<meta name="assert" content="Extensions to Element Interface: createShadowRoot method creates new instance of Shadow root object">
<meta name="assert" content="Extensions to Element Interface: attachShadow method creates new instance of Shadow root object">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../../../../html/resources/common.js"></script>
@ -28,9 +28,9 @@ test(function () {
var host = d.createElement('div');
d.body.appendChild(host);
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
assert_true(s instanceof ShadowRoot, 'createShadowRoot() method should create new instance ' +
assert_true(s instanceof ShadowRoot, 'attachShadow() method should create new instance ' +
'of ShadowRoot object');
}, 'A_10_02_02_01_T01');

View file

@ -13,7 +13,7 @@ policies and contribution forms [3].
<title>Shadow DOM Test: A_10_02_02_02</title>
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#shadow-aware-methods">
<meta name="assert" content="Extensions to Element Interface: createShadowRoot method">
<meta name="assert" content="Extensions to Element Interface: attachShadow method">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../../../../html/resources/common.js"></script>
@ -33,10 +33,10 @@ test(unit(function (ctx) {
span.innerHTML = 'Some text';
host.appendChild(span);
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
// span should become invisible as shadow root content
assert_equals(span.offsetTop, 0, 'createShadowRoot() method should establish ' +
assert_equals(span.offsetTop, 0, 'attachShadow() method should establish ' +
'the context object as the shadow host of the ShadowRoot object');
}), 'A_10_02_02_02_T01');

View file

@ -28,7 +28,7 @@ t.step(unit(function(ctx) {
var doc = newRenderedHTMLDocument(ctx);
var host = doc.createElement('div');
var shadowRoot = host.createShadowRoot();
var shadowRoot = host.attachShadow({mode: 'open'});
var child = doc.createElement('div');
doc.body.appendChild(host);

View file

@ -29,7 +29,7 @@ test(unit(function (ctx) {
var host = d.createElement('div');
d.body.appendChild(host);
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
assert_equals(s.activeElement, null, 'activeElement attribute of the ShadowRoot must return null if there\'s no focused element');
@ -42,7 +42,7 @@ test(unit(function (ctx) {
var host = d.createElement('div');
d.body.appendChild(host);
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var inp = d.createElement('input');
d.body.appendChild(inp);
@ -60,7 +60,7 @@ test(unit(function (ctx) {
var host = d.createElement('div');
d.body.appendChild(host);
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var inp = d.createElement('input');
d.body.appendChild(inp);

View file

@ -29,7 +29,7 @@ test(unit(function (ctx) {
var host = d.createElement('div');
host.setAttribute('id', 'shRoot');
d.body.appendChild(host);
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var inp = d.createElement('input');
inp.setAttribute('type', 'text');

View file

@ -28,7 +28,7 @@ test(unit(function (ctx) {
var host = d.createElement('div');
d.body.appendChild(host);
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var span = d.createElement('span');
span.innerHTML = 'Some text';

View file

@ -28,7 +28,7 @@ test(unit(function (ctx) {
var host = d.createElement('div');
d.body.appendChild(host);
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var span = d.createElement('span');
span.innerHTML = 'Some text';
@ -48,7 +48,7 @@ test(unit(function (ctx) {
var host = d.createElement('div');
d.body.appendChild(host);
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var span = d.createElement('span');
span.setAttribute('id', 'spanId');

View file

@ -28,7 +28,7 @@ test(unit(function (ctx) {
var host = d.createElement('div');
d.body.appendChild(host);
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
assert_true(s.styleSheets != null, 'ShadowRoot styleSheets attribute shouldn\'t be null');
assert_equals(s.styleSheets.length, 0, 'attribute must return the shadow root style sheets only');
@ -42,7 +42,7 @@ test(unit(function (ctx) {
var host = d.createElement('div');
d.body.appendChild(host);
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var style = d.createElement('style');
s.appendChild(style);

View file

@ -28,7 +28,7 @@ test(unit(function (ctx) {
var host = d.createElement('div');
d.body.appendChild(host);
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
assert_equals(s.nodeType, 11, 'The nodeType attribute of a ShadowRoot ' +
'instance must return DOCUMENT_FRAGMENT_NODE');

View file

@ -28,7 +28,7 @@ test(unit(function (ctx) {
var host = d.createElement('div');
d.body.appendChild(host);
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
assert_equals(s.nodeName, '#document-fragment', 'The nodeName attribute of a ShadowRoot instance ' +
'must return "#document-fragment".');

View file

@ -28,7 +28,7 @@ test(function () {
var el = d.createElement('div');
d.body.appendChild(el);
var s = el.createShadowRoot();
var s = el.attachShadow({mode: 'open'});
var child = d.createElement('span');
child.setAttribute('id', 'span_id');
@ -50,7 +50,7 @@ test(function () {
var el = d.createElement('div');
d.body.appendChild(el);
var s = el.createShadowRoot();
var s = el.attachShadow({mode: 'open'});
assert_true(s.getElementById('span_id') == null, ' ShadowRoot getElementById() ' +
'method should return null if matching element not found');

View file

@ -27,7 +27,7 @@ test(unit(function (ctx) {
var host = d.createElement('div');
d.body.appendChild(host);
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var span = d.createElement('span');
span.innerHTML = 'Some text';

View file

@ -44,7 +44,7 @@ test(function () {
var el = d.createElement('div');
var s = el.createShadowRoot();
var s = el.attachShadow({mode: 'open'});
d.body.appendChild(el);
if (typeof(s) == 'undefined' || typeof (s.elementFromPoint(1, 1)) != 'object') {

View file

@ -28,7 +28,7 @@ test(function () {
var el = d.createElement('div');
d.body.appendChild(el);
var s = el.createShadowRoot();
var s = el.attachShadow({mode: 'open'});
var span = d.createElement('span');
span.innerHTML = 'Some text';
@ -47,7 +47,7 @@ test(function () {
var el = d.createElement('div');
d.body.appendChild(el);
var s = el.createShadowRoot();
var s = el.attachShadow({mode: 'open'});
var span = d.createElement('span');
span.innerHTML = 'Some text';

View file

@ -12,8 +12,8 @@ policies and contribution forms [3].
<head>
<title>Shadow DOM Test: A_10_01_02_09</title>
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#shadow-root-methods">
<meta name="assert" content="ShadowRoot Object: Invoking the cloneNode() method on a ShadowRoot instance must always throw a DATA_CLONE_ERR exception.">
<link rel="help" href="https://dom.spec.whatwg.org/#dom-node-clonenode">
<meta name="assert" content="If context object is a shadow root, throw a NotSupportedError exception.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../../../../html/resources/common.js"></script>
@ -24,17 +24,17 @@ policies and contribution forms [3].
<script>
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
var host = d.createElement('div');
d.body.appendChild(host);
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
try {
s.cloneNode();
assert_true(false, 'Invoking the cloneNode() method on a ShadowRoot instance must always ' +
'throw a DATA_CLONE_ERR exception.');
'throw a NotSupportedError (code 9) exception.');
} catch (e) {
assert_equals(e.code, 25, 'Wrong exceprion type');
assert_equals(e.code, 9, 'Wrong exception type');
assert_equals(e.name, 'NotSupportedError', 'Wrong exception name');
}
}), 'A_10_01_02_09_T01');
</script>

View file

@ -33,7 +33,7 @@ A_05_05_03_T01.step(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
s.id = 'shadow';
var input1 = d.createElement('input');

View file

@ -35,7 +35,7 @@ A_05_01_01_T1.step(function () {
var div = d.createElement('div');
d.body.appendChild(div);
var s = div.createShadowRoot();
var s = div.attachShadow({mode: 'open'});
var div2 = d.createElement('div');
s.appendChild(div2);
@ -77,7 +77,7 @@ A_05_01_01_T2.step(function () {
var div = d.createElement('div');
d.body.appendChild(div);
var s = div.createShadowRoot();
var s = div.attachShadow({mode: 'open'});
var div2 = d.createElement('div');
s.appendChild(div2);

View file

@ -37,11 +37,11 @@ A_05_01_03_T01.step(unit(function (ctx) {
'</div>';
var ul = d.querySelector('#shadow-root');
var s = ul.createShadowRoot();
var s = ul.attachShadow({mode: 'open'});
//make shadow subtree
var div = document.createElement('div');
div.innerHTML = '<content select=".shadow"><span id="flbk">Fallback item</span></content>';
div.innerHTML = '<slot name="shadow"><span id="flbk">Fallback item</span></slot>';
s.appendChild(div);
d.body.addEventListener('click', A_05_01_03_T01.step_func(function (event) {

View file

@ -34,7 +34,7 @@ A_05_04_01_T01.step(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var inp1 = d.createElement('input');
inp1.setAttribute('id', 'inp1');

View file

@ -34,7 +34,7 @@ A_05_04_02_T01.step(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var inp1 = d.createElement('input');
inp1.setAttribute('id', 'inp1');

View file

@ -34,7 +34,7 @@ A_05_04_03_T01.step(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var inp1 = d.createElement('input');
inp1.setAttribute('id', 'inp1');

View file

@ -34,7 +34,7 @@ A_05_04_04_T01.step(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var inp1 = d.createElement('input');
inp1.setAttribute('id', 'inp1');

View file

@ -34,7 +34,7 @@ A_05_04_05_T01.step(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var inp1 = d.createElement('input');
inp1.setAttribute('id', 'inp1');

View file

@ -34,7 +34,7 @@ A_05_04_06_T01.step(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var inp1 = d.createElement('input');
inp1.setAttribute('id', 'inp1');

View file

@ -34,7 +34,7 @@ A_05_04_07_T01.step(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var inp1 = d.createElement('input');
inp1.setAttribute('id', 'inp1');

View file

@ -34,7 +34,7 @@ A_05_04_08_T01.step(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var inp1 = d.createElement('input');
inp1.setAttribute('id', 'inp1');

View file

@ -34,7 +34,7 @@ A_05_04_09_T01.step(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var inp1 = d.createElement('input');
inp1.setAttribute('id', 'inp1');

View file

@ -38,7 +38,7 @@ A_05_03_01_T01.step(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var inp1 = d.createElement('input');
inp1.setAttribute('id', 'inp1');
@ -78,7 +78,7 @@ A_05_03_01_T02.step(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var inp1 = d.createElement('input');
inp1.setAttribute('id', 'inp1');
@ -121,7 +121,7 @@ A_05_03_01_T03.step(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var inp1 = d.createElement('input');
inp1.setAttribute('id', 'inp1');
@ -161,7 +161,7 @@ A_05_03_01_T04.step(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var inp1 = d.createElement('input');
inp1.setAttribute('id', 'inp1');
@ -202,34 +202,34 @@ A_05_03_01_T05.step(unit(function (ctx) {
var inp1 = d.createElement('input');
inp1.setAttribute('id', 'inp1');
inp1.setAttribute('type', 'checkbox');
inp1.setAttribute('class', 'clazz1');
inp1.setAttribute('slot', 'slot1');
host.appendChild(inp1);
var inp2 = d.createElement('input');
inp2.setAttribute('id', 'inp2');
inp2.setAttribute('type', 'checkbox');
inp2.setAttribute('class', 'clazz2');
inp2.setAttribute('slot', 'slot2');
host.appendChild(inp2);
var inp3 = d.createElement('input');
inp3.setAttribute('id', 'inp3');
inp3.setAttribute('type', 'checkbox');
inp3.setAttribute('class', 'clazz1');
inp3.setAttribute('slot', 'slot1');
host.appendChild(inp3);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var shadowDiv = document.createElement('div');
shadowDiv.innerHTML = '<content select=".clazz1"></content>';
shadowDiv.innerHTML = '<slot name="slot1"></slot>';
s.appendChild(shadowDiv);
//element outside the shadow tree
var inp4 = d.createElement('input');
inp4.setAttribute('id', 'inp4');
inp4.setAttribute('type', 'checkbox');
inp4.setAttribute('class', 'clazz1');
inp4.setAttribute('slot', 'slot1');
d.body.appendChild(inp4);
inp1.focus();
@ -268,34 +268,34 @@ A_05_03_01_T06.step(unit(function (ctx) {
var inp1 = d.createElement('input');
inp1.setAttribute('id', 'inp1');
inp1.setAttribute('type', 'checkbox');
inp1.setAttribute('class', 'clazz1');
inp1.setAttribute('slot', 'slot1');
host.appendChild(inp1);
var inp2 = d.createElement('input');
inp2.setAttribute('id', 'inp2');
inp2.setAttribute('type', 'checkbox');
inp2.setAttribute('class', 'clazz2');
inp2.setAttribute('slot', 'slot2');
host.appendChild(inp2);
var inp3 = d.createElement('input');
inp3.setAttribute('id', 'inp3');
inp3.setAttribute('type', 'checkbox');
inp3.setAttribute('class', 'clazz1');
inp3.setAttribute('slot', 'slot1');
host.appendChild(inp3);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var shadowDiv = document.createElement('div');
shadowDiv.innerHTML = '<content select=".clazz1"></content>';
shadowDiv.innerHTML = '<slot name="slot1"></slot>';
s.appendChild(shadowDiv);
//element outside the shadow tree
var inp4 = d.createElement('input');
inp4.setAttribute('id', 'inp4');
inp4.setAttribute('type', 'checkbox');
inp4.setAttribute('class', 'clazz1');
inp4.setAttribute('slot', 'slot1');
d.body.appendChild(inp4);
inp4.focus();

View file

@ -34,7 +34,7 @@ A_05_02_01_T01.step(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var div1 = d.createElement('div');
div1.setAttribute('style', 'height:40px; width:100%');

View file

@ -34,7 +34,7 @@ A_05_02_02_T01.step(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var div1 = d.createElement('div');
div1.setAttribute('style', 'height:100%; width:100%');

View file

@ -12,8 +12,8 @@ policies and contribution forms [3].
<head>
<title>Shadow DOM Test: A_05_02_03</title>
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-201305214#retargeting-related-target">
<meta name="assert" content="Retargeting relatedTarget:Event listeners must not be invoked on a node for which the target and relatedTarget are the same.">
<link rel="help" href="https://w3c.github.io/webcomponents/spec/shadow/#event-relatedtarget-retargeting">
<meta name="assert" content="The value of the Event object's relatedTarget attribute must be the result of the retargeting algorithm with the event's currentTarget and relatedTarget as input. The result is called a relative related target.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../../../html/resources/common.js"></script>
@ -34,27 +34,19 @@ A_05_02_03_T01.step(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var div1 = d.createElement('div');
div1.setAttribute('style', 'height:100%; width:100%');
div1.setAttribute('id', 'div1');
s.appendChild(div1);
var div2 = d.createElement('div');
div2.setAttribute('style', 'height:100%; width:100%');
div2.setAttribute('id', 'div2');
s.appendChild(div2);
s.addEventListener('mouseover', A_05_02_03_T01.step_func(function(event) {
assert_true(false, 'Event listeners shouldn\'t be invoked if target and relatedTarget are the same');
host.addEventListener('mouseover', A_05_02_03_T01.step_func(function(event) {
assert_unreached('Event listeners shouldn\'t be invoked if relative target and relative related target are the same');
}), false);
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("mouseover", true, false, window,
0, 10, 10, 10, 10, false, false, false, false, 0, div1);
var evt = new MouseEvent("mouseover",
{ relatedTarget: div1, relatedTargetScoped: true });
div1.dispatchEvent(evt);
A_05_02_03_T01.done();

View file

@ -36,7 +36,7 @@ A_05_00_01_T1.step(function () {
var div = d.createElement('div');
d.body.appendChild(div);
var s = div.createShadowRoot();
var s = div.attachShadow({mode: 'open'});
var div2 = d.createElement('div');
s.appendChild(div2);

View file

@ -1,232 +0,0 @@
<!DOCTYPE html>
<!--
Distributed under both the W3C Test Suite License [1] and the W3C
3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
policies and contribution forms [3].
[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
[3] http://www.w3.org/2004/10/27-testcases
-->
<html>
<head>
<title>Shadow DOM Test: A_09_00_01</title>
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#html-elements-and-their-shadow-trees">
<meta name="assert" content="HTML Elements and Their Shadow Trees: If the element can have fallback content, UA should allow the shadow tree to contain at least one insertion point.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../../html/resources/common.js"></script>
<script src="../../resources/shadow-dom-utils.js"></script>
</head>
<body>
<div id="log"></div>
<script>
//test iframe
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
// create element
var el = d.createElement('iframe');
d.body.appendChild(el);
el.innerHTML = '' +
'<span id="shadow">This is a node that should be distributed</span>' +
'<span id="flbk">This is a fallback content</span>';
var s = el.createShadowRoot();
s.innerHTML = '<content select="#shadow"></content>';
assert_true(d.querySelector('#shadow').offsetTop > 0, 'Iframe should allow at least one insertion point');
assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
}), 'A_09_00_01_T01');
//test object
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
// create element
var el = d.createElement('object');
d.body.appendChild(el);
el.innerHTML = '' +
'<span id="shadow">This is a node that should be distributed</span>' +
'<span id="flbk">This is a fallback content</span>';
var s = el.createShadowRoot();
s.innerHTML = '<content select="#shadow"></content>';
assert_true(d.querySelector('#shadow').offsetTop > 0, 'object should allow at least one insertion point');
assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
}), 'A_09_00_01_T02');
//test video
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
// create element
var el = d.createElement('video');
d.body.appendChild(el);
el.innerHTML = '' +
'<span id="shadow">This is a node that should be distributed</span>' +
'<span id="flbk">This is a fallback content</span>';
var s = el.createShadowRoot();
s.innerHTML = '<content select="#shadow"></content>';
assert_true(d.querySelector('#shadow').offsetTop > 0, 'video should allow at least one insertion point');
assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
}), 'A_09_00_01_T03');
//test audio
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
// create element
var el = d.createElement('audio');
d.body.appendChild(el);
el.innerHTML = '' +
'<span id="shadow">This is a node that should be distributed</span>' +
'<span id="flbk">This is a fallback content</span>';
var s = el.createShadowRoot();
s.innerHTML = '<content select="#shadow"></content>';
assert_true(d.querySelector('#shadow').offsetTop > 0, 'audio should allow at least one insertion point');
assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
}), 'A_09_00_01_T04');
//test canvas
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
// create element
var el = d.createElement('canvas');
d.body.appendChild(el);
el.innerHTML = '' +
'<span id="shadow">This is a node that should be distributed</span>' +
'<span id="flbk">This is a fallback content</span>';
var s = el.createShadowRoot();
s.innerHTML = '<content select="#shadow"></content>';
assert_true(d.querySelector('#shadow').offsetTop > 0, 'canvas should allow at least one insertion point');
assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
}), 'A_09_00_01_T05');
//test map
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
var img = d.createElement('img');
img.setAttribute('usemap', '#theMap');
img.setAttribute('width', '20px');
img.setAttribute('height', '20px');
d.body.appendChild(img);
// create element
var el = d.createElement('map');
el.setAttribute('name', 'theMap');
d.body.appendChild(el);
el.innerHTML = '' +
'<span id="shadow">This is a node that should be distributed</span>' +
'<span id="flbk">This is a fallback content</span>';
var s = el.createShadowRoot();
s.innerHTML = '<content select="#shadow"></content>';
assert_true(d.querySelector('#shadow').offsetTop > 0, 'map should allow at least one insertion point');
assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
}), 'A_09_00_01_T06');
//test textarea
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
// create element
var el = d.createElement('textarea');
d.body.appendChild(el);
el.innerHTML = '' +
'<span id="shadow">This is a node that should be distributed</span>' +
'<span id="flbk">This is a fallback content</span>';
var s = el.createShadowRoot();
s.innerHTML = '<content select="#shadow"></content>';
assert_true(d.querySelector('#shadow').offsetTop > 0, 'textarea should allow at least one insertion point');
assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
}), 'A_09_00_01_T07');
//test progress
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
// create element
var el = d.createElement('progress');
d.body.appendChild(el);
el.innerHTML = '' +
'<span id="shadow">This is a node that should be distributed</span>' +
'<span id="flbk">This is a fallback content</span>';
var s = el.createShadowRoot();
s.innerHTML = '<content select="#shadow"></content>';
assert_true(d.querySelector('#shadow').offsetTop > 0, 'progress should allow at least one insertion point');
assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
}), 'A_09_00_01_T08');
//test meter
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
// create element
var el = d.createElement('meter');
d.body.appendChild(el);
el.innerHTML = '' +
'<span id="shadow">This is a node that should be distributed</span>' +
'<span id="flbk">This is a fallback content</span>';
var s = el.createShadowRoot();
s.innerHTML = '<content select="#shadow"></content>';
assert_true(d.querySelector('#shadow').offsetTop > 0, 'meter should allow at least one insertion point');
assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
}), 'A_09_00_01_T09');
</script>
</body>
</html>

View file

@ -1,82 +0,0 @@
<!DOCTYPE html>
<!--
Distributed under both the W3C Test Suite License [1] and the W3C
3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
policies and contribution forms [3].
[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
[3] http://www.w3.org/2004/10/27-testcases
-->
<html>
<head>
<title>Shadow DOM Test: A_09_00_02</title>
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#html-elements-and-their-shadow-trees">
<meta name="assert" content="HTML Elements and Their Shadow Trees: Elements that have no fallback content should allow the shadow tree to contain no insertion points or an insertion point that matches nothing">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../../html/resources/common.js"></script>
<script src="../../resources/shadow-dom-utils.js"></script>
</head>
<body>
<div id="log"></div>
<script>
//test img
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
// create element
var el = d.createElement('img');
d.body.appendChild(el);
var s = el.createShadowRoot();
s.innerHTML = '<content id="cont" select="#shadow"></content>';
assert_true(s.querySelector('#cont') != null, 'img should allow one insertion point ' +
'that matches nothing');
}), 'A_09_00_02_T01');
//test embed
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
// create element
var el = d.createElement('embed');
d.body.appendChild(el);
var s = el.createShadowRoot();
s.innerHTML = '<content id="cont" select="#shadow"></content>';
assert_true(s.querySelector('#cont') != null, 'embed should allow one insertion point ' +
'that matches nothing');
}), 'A_09_00_02_T02');
//test embed
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
// create element
var el = d.createElement('input');
d.body.appendChild(el);
var s = el.createShadowRoot();
s.innerHTML = '<content id="cont" select="#shadow"></content>';
assert_true(s.querySelector('#cont') != null, 'input should allow one insertion point ' +
'that matches nothing');
}), 'A_09_00_02_T03');
</script>
</body>
</html>

View file

@ -1,73 +0,0 @@
<!DOCTYPE html>
<!--
Distributed under both the W3C Test Suite License [1] and the W3C
3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
policies and contribution forms [3].
[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
[3] http://www.w3.org/2004/10/27-testcases
-->
<html>
<head>
<title>Shadow DOM Test: A_09_00_03</title>
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#html-elements-and-their-shadow-trees">
<meta name="assert" content="HTML Elements and Their Shadow Trees: Check that fieldset can contain at least two insertion points with matching criteria 'legend:first-of-type' and 'universal selector'">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../../html/resources/common.js"></script>
<script src="../../resources/shadow-dom-utils.js"></script>
</head>
<body>
<div id="log"></div>
<script>
//test universal selector
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
// create element
var el = d.createElement('fieldset');
d.body.appendChild(el);
el.innerHTML = '' +
'<span id="shadow">This is a node that should be distributed</span>' +
'<span id="flbk">This is a fallback content</span>';
var s = el.createShadowRoot();
s.innerHTML = '<content select="#shadow"></content>';
assert_true(d.querySelector('#shadow').offsetTop > 0, 'fieldset should allow at least one insertion point');
assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
}), 'A_09_00_03_T01');
//test legend:first-of-type
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
// create element
var el = d.createElement('fieldset');
d.body.appendChild(el);
el.innerHTML = '' +
'<legend>'
'<span id="shadow">This is a node that should be distributed</span>' +
'</legend>' +
'<span id="flbk">Unlucky content</span>';
var s = el.createShadowRoot();
s.innerHTML = '<content select="legend:first-of-type"></content>';
assert_true(d.querySelector('#shadow').offsetTop > 0, 'fieldset should allow insertion point ' +
'with legend:first-of-type matching criteria');
assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
}), 'A_09_00_03_T02');
</script>
</body>
</html>

View file

@ -1,48 +0,0 @@
<!DOCTYPE html>
<!--
Distributed under both the W3C Test Suite License [1] and the W3C
3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
policies and contribution forms [3].
[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
[3] http://www.w3.org/2004/10/27-testcases
-->
<html>
<head>
<title>Shadow DOM Test: A_09_00_04</title>
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#html-elements-and-their-shadow-trees">
<meta name="assert" content="HTML Elements and Their Shadow Trees: Check that details can contain at least two insertion points with matching criteria 'summary:first-of-type' and 'universal selector'">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../../html/resources/common.js"></script>
<script src="../../resources/shadow-dom-utils.js"></script>
</head>
<body>
<div id="log"></div>
<script>
//test universal selector
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
// create element
var el = d.createElement('details');
el.setAttribute('open', 'open');
d.body.appendChild(el);
el.innerHTML = '' +
'<span id="shadow">This is a node that should be distributed</span>' +
'<span id="flbk">This is a fallback content</span>';
var s = el.createShadowRoot();
s.innerHTML = '<content select="#shadow"></content>';
assert_true(d.querySelector('#shadow').offsetTop > 0, '\'details\' should allow at least one insertion point');
assert_equals(d.querySelector('#flbk').offsetTop, 0, 'Fallback content shouldn\'t be rendered');
}), 'A_09_00_04_T01');
</script>
</body>
</html>

View file

@ -31,7 +31,7 @@ test(function () {
var div = d.createElement('div');
d.body.appendChild(div);
var s = div.createShadowRoot();
var s = div.attachShadow({mode: 'open'});
HTML5_FORM_ASSOCIATED_ELEMENTS.forEach(function (tagName) {
@ -56,7 +56,7 @@ test(function () {
var div = d.createElement('div');
form.appendChild(div);
s = div.createShadowRoot();
s = div.attachShadow({mode: 'open'});
HTML5_FORM_ASSOCIATED_ELEMENTS.forEach(function (tagName) {

View file

@ -31,7 +31,7 @@ test(function () {
var div = d.createElement('div');
d.body.appendChild(div);
var s = div.createShadowRoot();
var s = div.attachShadow({mode: 'open'});
HTML5_FORM_ASSOCIATED_ELEMENTS.forEach(function (tagName) {
@ -58,7 +58,7 @@ test(function () {
var div = d.createElement('div');
form.appendChild(div);
var s = div.createShadowRoot();
var s = div.attachShadow({mode: 'open'});
HTML5_FORM_ASSOCIATED_ELEMENTS.forEach(function (tagName) {
@ -88,10 +88,11 @@ test(function () {
var el = d.createElement(tagName);
el.setAttribute('id', tagName + '_id');
el.setAttribute('slot', tagName + '_slot');
div.appendChild(el);
var s = div.createShadowRoot();
s.innerHTML = '<content select="' + tagName + '"></content>';
var s = div.attachShadow({mode: 'open'});
s.innerHTML = '<slot name="' + tagName + '_slot"></slot>';
assert_true(s.querySelector('#' + tagName + '_id') == null, 'Distributed form-associated element ' + tagName +
' in shadow tree must not be accessible shadow tree accessors');

View file

@ -12,8 +12,8 @@ policies and contribution forms [3].
<head>
<title>Shadow DOM Test: A_08_02_03</title>
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#inert-html-elements">
<meta name="assert" content="HTML Elements in shadow trees: form should submit elements in shadow tree">
<link rel="help" href="https://w3c.github.io/webcomponents/spec/shadow/#inertness-of-html-elements-in-a-shadow-tree">
<meta name="assert" content="HTML Elements in shadow trees: form should not submit elements in shadow tree">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../../../html/resources/common.js"></script>
@ -23,17 +23,18 @@ policies and contribution forms [3].
<script>
var A_08_02_03_T01 = async_test('A_08_02_03_T01', { timeout: 5000 });
A_08_02_03_T01.checkIframeContent = A_08_02_03_T01.step_func(function () {
//remember value to check before cleaning the context (it'll destroy the iframe)
var checkIframeContent = A_08_02_03_T01.step_func(function () {
// remember value to check before cleaning the context (it'll destroy the iframe)
var valueToCheck = A_08_02_03_T01.iframe.contentWindow.document.URL;
cleanContext(A_08_02_03_T01.ctx);
assert_true(valueToCheck.indexOf('inp1=value1') > 0,
'html form should submit all of its fields');
// Expected behavior is not quite clear. See https://www.w3.org/Bugs/Public/show_bug.cgi?id=20320
assert_true(valueToCheck.indexOf('inp2=value2') > 0,
'html form should submit all of its fields including the shadow ones');
// Form data crossing shadow boundary should not be submitted.
// https://github.com/w3c/webcomponents/issues/65
assert_equals(valueToCheck.indexOf('inp2=value2'), -1,
'html form should not submit fields in the shadow tree');
A_08_02_03_T01.done();
});
@ -46,13 +47,12 @@ A_08_02_03_T01.step(function () {
//create iframe
var iframe = document.createElement('iframe');
A_08_02_03_T01.iframe = iframe;
iframe.src = '../../resources/blank.html';
iframe.setAttribute('name', 'targetIframe');
d.body.appendChild(iframe);
A_08_02_03_T01.iframe = iframe;
// create form
var form = d.createElement('form');
form.setAttribute('target', 'targetIframe');
@ -60,11 +60,10 @@ A_08_02_03_T01.step(function () {
form.setAttribute('action', '../../resources/blank.html');
d.body.appendChild(form);
//create Shadow root
// create shadow root
var root = d.createElement('div');
form.appendChild(root);
var s = root.createShadowRoot();
var s = root.attachShadow({mode: 'open'});
var input1 = d.createElement('input');
input1.setAttribute('type', 'text');
@ -78,11 +77,11 @@ A_08_02_03_T01.step(function () {
input2.setAttribute('value', 'value2');
s.appendChild(input2);
//submit the form
// submit the form
form.submit();
// set timeout to give the iframe time to load content
setTimeout('A_08_02_03_T01.checkIframeContent()', 2000);
setTimeout(checkIframeContent, 2000);
});
</script>
</body>

View file

@ -58,7 +58,7 @@ A_08_01_01_T01.step(function () {
//create Shadow root
var root = d.createElement('div');
d.body.appendChild(root);
var s = root.createShadowRoot();
var s = root.attachShadow({mode: 'open'});
// create base element, set iframe as a target
var base = d.createElement('base');

View file

@ -32,7 +32,7 @@ test(unit(function (ctx) {
//create Shadow root
var root = d.createElement('div');
d.body.appendChild(root);
var s = root.createShadowRoot();
var s = root.attachShadow({mode: 'open'});
s.appendChild(link);

View file

@ -1,102 +0,0 @@
<!DOCTYPE html>
<!--
Distributed under both the W3C Test Suite License [1] and the W3C
3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
policies and contribution forms [3].
[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
[3] http://www.w3.org/2004/10/27-testcases
-->
<html>
<head>
<title>Shadow DOM Test: A_04_02_04</title>
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#lower-boundary-encapsulation">
<meta name="assert" content="Lower-boundary encapsulation: The distribution reoccurs whenever any variable affecting it is changed">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../../../html/resources/common.js"></script>
</head>
<body>
<div id="log"></div>
<script>
var A_04_02_04_T1 = async_test('A_04_02_04_T01');
A_04_02_04_T1.step(function () {
var iframe = document.createElement('iframe');
iframe.src = '../../resources/bobs_page.html';
document.body.appendChild(iframe);
iframe.onload = A_04_02_04_T1.step_func(function () {
try {
var d = iframe.contentDocument;
var ul = d.querySelector('ul.stories');
var s = ul.createShadowRoot();
//make shadow subtree
var subdiv1 = document.createElement('div');
subdiv1.innerHTML = '<ul><content select=".shadow"></content></ul>';
s.appendChild(subdiv1);
//The order of <li> elements at this point should be the following:
//li3, li6, li11, li12, 1i13, li14, li15. Other elements (li1, li2, li4, li5) invisible
assert_true(d.querySelector('#li3').offsetTop < d.querySelector('#li6').offsetTop,
'Point 1: Elements that mach insertion point criteria don\'t participate in distribution');
assert_true(d.querySelector('#li6').offsetTop < d.querySelector('#li11').offsetTop,
'Point 2: Elements that mach insertion point criteria don\'t participate in distribution');
assert_true(d.querySelector('#li11').offsetTop < d.querySelector('#li12').offsetTop,
'Point 3: Elements that mach insertion point criteria don\'t participate in distribution');
assert_true(d.querySelector('#li12').offsetTop < d.querySelector('#li13').offsetTop,
'Point 4: Elements that mach insertion point criteria don\'t participate in distribution');
assert_true(d.querySelector('#li13').offsetTop < d.querySelector('#li14').offsetTop,
'Point 5: Elements that mach insertion point criteria don\'t participate in distribution');
assert_true(d.querySelector('#li14').offsetTop < d.querySelector('#li15').offsetTop,
'Point 6: Elements that mach insertion point criteria don\'t participate in distribution');
assert_equals(d.querySelector('#li1').offsetTop, 0,
'Point 7: Elements that don\'t mach insertion point criteria participate in distribution');
assert_equals(d.querySelector('#li2').offsetTop, 0,
'Point 8: Elements that don\'t mach insertion point criteria participate in distribution');
assert_equals(d.querySelector('#li4').offsetTop, 0,
'Point 9: Elements that don\'t mach insertion point criteria participate in distribution');
assert_equals(d.querySelector('#li5').offsetTop, 0,
'Point 10: Elements that don\'t mach insertion point criteria participate in distribution');
var li5 = d.querySelector('#li5');
li5.className = 'shadow';
// When class name changed distribution must reoccur
//The order of <li> elements should now be the following:
//li3, li6, li5, li11, li12, 1i13, li14, li15. Invisible: li1, li2, li4
assert_true(d.querySelector('#li3').offsetTop < d.querySelector('#li6').offsetTop,
'Point 11: Elements that mach insertion point criteria don\'t participate in distribution');
assert_true(d.querySelector('#li6').offsetTop < d.querySelector('#li5').offsetTop,
'Point 12: Elements that mach insertion point criteria don\'t participate in distribution');
assert_true(d.querySelector('#li5').offsetTop < d.querySelector('#li11').offsetTop,
'Point 13: Elements that mach insertion point criteria don\'t participate in distribution');
assert_true(d.querySelector('#li11').offsetTop < d.querySelector('#li12').offsetTop,
'Point 14: Elements that mach insertion point criteria don\'t participate in distribution');
assert_true(d.querySelector('#li12').offsetTop < d.querySelector('#li13').offsetTop,
'Point 15: Elements that mach insertion point criteria don\'t participate in distribution');
assert_true(d.querySelector('#li13').offsetTop < d.querySelector('#li14').offsetTop,
'Point 16: Elements that mach insertion point criteria don\'t participate in distribution');
assert_true(d.querySelector('#li14').offsetTop < d.querySelector('#li15').offsetTop,
'Point 17: Elements that mach insertion point criteria don\'t participate in distribution');
assert_equals(d.querySelector('#li1').offsetTop, 0,
'Point 18: Elements that don\'t mach insertion point criteria participate in distribution');
assert_equals(d.querySelector('#li2').offsetTop, 0,
'Point 19: Elements that don\'t mach insertion point criteria participate in distribution');
assert_equals(d.querySelector('#li4').offsetTop, 0,
'Point 20: Elements that don\'t mach insertion point criteria participate in distribution');
} finally {
iframe.parentNode.removeChild(iframe);
}
A_04_02_04_T1.done();
});
});
</script>
</body>
</html>

View file

@ -21,9 +21,9 @@
<div id='host'>
</div>
<script>
var shadowRoot = document.getElementById('host').createShadowRoot();
var shadowRoot = document.getElementById('host').attachShadow({mode: 'open'});
shadowRoot.innerHTML = '<div id="sub" style="width: 100%;height:100%;"></div>';
var nestedRoot = shadowRoot.getElementById('sub').createShadowRoot();
var nestedRoot = shadowRoot.getElementById('sub').attachShadow({mode: 'open'});
nestedRoot.innerHTML = '<div style="width:100%; height:100%;background-color: green;"></div>';
</script>
</body>

View file

@ -29,11 +29,11 @@ policies and contribution forms [3].
<div class="pass">Orange.</div>
</div>
<script>
var shadowRoot = host.createShadowRoot(host);
shadowRoot.innerHTML = '<div id="host2">Hello a Shadow Root.<content></content><div>Banana.</div></div>';
var shadowRoot = host.attachShadow({mode: 'open'});
shadowRoot.innerHTML = '<div id="host2">Hello a Shadow Root.<slot></slot><div>Banana.</div></div>';
var host2 = shadowRoot.getElementById("host2");
var shadowRoot2 = host2.createShadowRoot(host2);
shadowRoot2.innerHTML = '<div>Hello a Shadow Root2.</div><div><content></content></div>';
var shadowRoot2 = host2.attachShadow({mode: 'open'});
shadowRoot2.innerHTML = '<div>Hello a Shadow Root2.</div><div><slot></slot></div>';
</script>
</body>
</html>

View file

@ -26,7 +26,7 @@ p { color: black; }
<p>You should see green text saying "PASS" below.</p>
<div id="host">FAIL</div>
<script>
var shadowRoot = window.host.createShadowRoot();
var shadowRoot = window.host.attachShadow({mode: 'open'});
shadowRoot.innerHTML =
'<style>#pass { color: green; }</style>\n' +
'<div id="pass">PASS</div>';

View file

@ -34,7 +34,7 @@ in this order.
<div class="pass">C</div>
</div>
<script>
var shadowRoot = window.host.createShadowRoot();
var shadowRoot = window.host.attachShadow({mode: 'open'});
shadowRoot.innerHTML =
'<style>\n' +
@ -42,7 +42,7 @@ shadowRoot.innerHTML =
'* { color: red; }\n' +
'</style>' +
'<div class="shadow-pass">A</div>\n' +
'<content>FAIL</content>' +
'<slot>FAIL</slot>' +
'<div class="shadow-pass">D</div>';
</script>
</body>

View file

@ -13,7 +13,7 @@
</span>
<script>
var parent = document.getElementById('parent');
var shadow = parent.createShadowRoot();
var shadow = parent.attachShadow({mode: 'open'});
var child = document.createElement('span');
child.textContent = "if NOT underlined, it is success.";
shadow.appendChild(child);

View file

@ -199,7 +199,7 @@ test(function () {
body.appendChild(pHost);
doc.documentElement.appendChild(body);
var shadowRoot = body.createShadowRoot();
var shadowRoot = body.attachShadow({mode: 'open'});
var pShadow = doc.createElementNS(namespace, 'p');
pShadow.className = "shadow";
shadowRoot.appendChild(pShadow);
@ -213,7 +213,7 @@ test(function () {
test(function () {
var doc = document.implementation.createHTMLDocument('');
populateTestContentToHostDocument(doc);
var shadowRoot = doc.documentElement.createShadowRoot();
var shadowRoot = doc.body.attachShadow({mode: 'open'});
populateTestContentToShadowRoot(shadowRoot);
shadowRoot.querySelectorAll('p')[0].id = 'test-id';

View file

@ -27,11 +27,11 @@ policies and contribution forms [3].
test(function () {
var doc = document.implementation.createHTMLDocument('Test');
doc.body.innerHTML = '<div>A<div>B</div>C<div><span>D</span></div>E</div>';
var nodeIterator = doc.createNodeIterator(doc.documentElement,
var nodeIterator = doc.createNodeIterator(doc.body,
NodeFilter.SHOW_ELEMENT, null);
var node;
while (node = nodeIterator.nextNode()) {
var shadowRoot = node.createShadowRoot();
var shadowRoot = node.attachShadow({mode: 'open'});
assert_equals(shadowRoot.ownerDocument, doc);
}
}, 'ownerDocument property of a shadow root should be the document of the ' +
@ -50,7 +50,7 @@ test(function () {
for (var depth = 1; depth <= MAX_DEPTH; ++depth) {
var host = doc.getElementById('depth-' + depth);
var shadowRoot = host.createShadowRoot();
var shadowRoot = host.attachShadow({mode: 'open'});
assert_equals(shadowRoot.ownerDocument, doc,
'ownerDocument mismatch for #depth-' + depth);
}
@ -60,7 +60,7 @@ test(function () {
test(function () {
var doc = document.implementation.createHTMLDocument('Test');
var shadowRoot = doc.body.createShadowRoot();
var shadowRoot = doc.body.attachShadow({mode: 'open'});
var div = doc.createElement('div');
shadowRoot.appendChild(div);
assert_equals(div.ownerDocument, doc);
@ -70,7 +70,7 @@ test(function () {
test(function () {
var doc1 = document.implementation.createHTMLDocument('Test 1');
var doc2 = document.implementation.createHTMLDocument('Test 2');
var shadowRoot = doc1.body.createShadowRoot();
var shadowRoot = doc1.body.attachShadow({mode: 'open'});
var div = doc2.createElement('div');
shadowRoot.appendChild(div);
assert_equals(div.ownerDocument, doc1);
@ -81,7 +81,7 @@ test(function () {
test(function () {
var doc1 = document.implementation.createHTMLDocument('Test 1');
var doc2 = document.implementation.createHTMLDocument('Test 2');
var shadowRoot = doc1.body.createShadowRoot();
var shadowRoot = doc1.body.attachShadow({mode: 'open'});
doc2.body.innerHTML =
'<div id="root">A<div>B</div>C<div><span>D</span></div>E</div>';
shadowRoot.appendChild(doc2.getElementById('root'));
@ -97,7 +97,7 @@ test(function () {
test(function () {
var doc1 = document.implementation.createHTMLDocument('Test 1');
var doc2 = document.implementation.createHTMLDocument('Test 2');
var shadowRoot = doc1.body.createShadowRoot();
var shadowRoot = doc1.body.attachShadow({mode: 'open'});
doc2.body.innerHTML = '<div id="parent"><div id="child"></div></div>';
shadowRoot.appendChild(doc2.getElementById('child'));
assert_equals(doc2.getElementById('parent').ownerDocument, doc2);

View file

@ -35,7 +35,7 @@ function createTestDocument() {
pHost.className = 'test-class';
pHost.id = 'test-id';
doc.body.appendChild(pHost);
var shadowRoot = doc.body.createShadowRoot();
var shadowRoot = doc.body.attachShadow({mode: 'open'});
var pShadow = doc.createElement('p');
pShadow.className = 'test-class';
pShadow.id = 'test-id';

View file

@ -36,7 +36,7 @@ function createTestDocument() {
pHost.className = 'test-class';
pHost.id = 'test-id';
doc.body.appendChild(pHost);
var shadowRoot = doc.body.createShadowRoot();
var shadowRoot = doc.body.attachShadow({mode: 'open'});
var pShadow = doc.createElement('p');
pShadow.className = 'test-class';
pShadow.id = 'test-id';

View file

@ -25,22 +25,22 @@ policies and contribution forms [3].
<script>
test(function () {
var doc = document.implementation.createHTMLDocument('Test');
var shadowRoot = doc.body.createShadowRoot();
var shadowRoot = doc.body.attachShadow({mode: 'open'});
assert_equals(shadowRoot.parentNode, null);
}, 'The parentNode attribute of a shadow root must always return null.');
test(function () {
var doc = document.implementation.createHTMLDocument('Test');
var shadowRoot = doc.body.createShadowRoot();
var shadowRoot = doc.body.attachShadow({mode: 'open'});
assert_equals(shadowRoot.parentElement, null);
}, 'The parentElement attribute of a shadow root must always return null.');
test(function () {
var doc = document.implementation.createHTMLDocument('Test');
var outerShadowRoot = doc.body.createShadowRoot();
var outerShadowRoot = doc.body.attachShadow({mode: 'open'});
var div = doc.createElement('div');
outerShadowRoot.appendChild(div);
var innerShadowRoot = div.createShadowRoot();
var innerShadowRoot = div.attachShadow({mode: 'open'});
assert_equals(innerShadowRoot.parentNode, null);
},
'The parentNode attribute of a shadow root must always return null, ' +
@ -49,10 +49,10 @@ test(function () {
test(function () {
var doc = document.implementation.createHTMLDocument('Test');
var outerShadowRoot = doc.body.createShadowRoot();
var outerShadowRoot = doc.body.attachShadow({mode: 'open'});
var div = doc.createElement('div');
outerShadowRoot.appendChild(div);
var innerShadowRoot = div.createShadowRoot();
var innerShadowRoot = div.attachShadow({mode: 'open'});
assert_equals(innerShadowRoot.parentElement, null);
},
'The parentElement attribute of a shadow root must always return null, ' +

View file

@ -26,7 +26,7 @@ test(function () {
var d = newHTMLDocument();
var div = d.createElement('div');
d.body.appendChild(div);
var s = div.createShadowRoot();
var s = div.attachShadow({mode: 'open'});
// node in shadow with id
var input = d.createElement('input');
@ -52,7 +52,7 @@ test(function () {
var d = newHTMLDocument();
var div = d.createElement('div');
d.body.appendChild(div);
var s = div.createShadowRoot();
var s = div.attachShadow({mode: 'open'});
var form = d.createElement('form');
form.setAttribute('id', 'form_id');

View file

@ -26,7 +26,7 @@ test(function () {
var d = newHTMLDocument();
var div = d.createElement('div');
d.body.appendChild(div);
var s = div.createShadowRoot();
var s = div.attachShadow({mode: 'open'});
var input = d.createElement('input');
input.setAttribute('type', 'text');
@ -61,7 +61,7 @@ test(function () {
div = d.createElement('div');
d.body.appendChild(div);
var s = div.createShadowRoot();
var s = div.attachShadow({mode: 'open'});
s.appendChild(form);
s.appendChild(el);

View file

@ -35,7 +35,7 @@ test(unit(function (ctx) {
//create Shadow root
var root = d.createElement('div');
d.body.appendChild(root);
var s = root.createShadowRoot();
var s = root.attachShadow({mode: 'open'});
s.appendChild(link);

View file

@ -28,7 +28,7 @@ test(function () {
try {
host.style.display = 'none';
document.body.appendChild(host);
var shadowRoot = host.createShadowRoot();
var shadowRoot = host.attachShadow({mode: 'open'});
var iframe = document.createElement('iframe');
iframe.style.display = 'none';
iframe.name = 'test-name';

View file

@ -25,7 +25,7 @@ policies and contribution forms [3].
<script>
function testNameAttribute(elementName) {
var doc = document.implementation.createHTMLDocument('Title');
var shadowRoot = doc.body.createShadowRoot();
var shadowRoot = doc.body.attachShadow({mode: 'open'});
var element = doc.createElement(elementName);
element.name = 'test-name';
shadowRoot.appendChild(element);

View file

@ -26,7 +26,7 @@ policies and contribution forms [3].
<script>
function testIDAttribute(elementName) {
var doc = document.implementation.createHTMLDocument('Title');
var shadowRoot = doc.body.createShadowRoot();
var shadowRoot = doc.body.attachShadow({mode: 'open'});
var element = doc.createElement(elementName);
element.id = 'test-id';
shadowRoot.appendChild(element);

View file

@ -1,73 +0,0 @@
<!DOCTYPE html>
<!--
Distributed under both the W3C Test Suite License [1] and the W3C
3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
policies and contribution forms [3].
[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
[3] http://www.w3.org/2004/10/27-testcases
-->
<html>
<head>
<title>Shadow DOM Test: A_06_01_01</title>
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#css-variables">
<meta name="assert" content="CSS variables: The shadow host styles being inherited by the children of the shadow root must also apply to CSS Variables.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../../../html/resources/common.js"></script>
<script src="../../../resources/shadow-dom-utils.js"></script>
</head>
<body>
<div id="log"></div>
<script>
//TODO For now (November, 2012) CSS variables support is not implemented yet
// so this test won't work. Treat it as a placeholder for now
test(unit(function (ctx) {
var d = newRenderedHTMLDocument(ctx);
d.head.innerHtml = '' +
'<style>' +
'body {font-size:10px;}' +
'</style>';
d.body.innerHTML =
'<ul id="shHost">' +
'<li id="li1" class="shadow">1</li>' +
'<li id="li2" class="shadow2">2</li>' +
'<li id="li3" class="shadow">3</li>' +
'<li id="li4">4</li>' +
'<li id="li5" class="shadow">5</li>' +
'<li id="li6" class="shadow2">6</li>' +
'</ul>';
var host = d.querySelector('#shHost');
var s = host.createShadowRoot();
var div = d.createElement('div');
div.innerHTML ='<ul><content select=".shadow"></content></ul>';
s.appendChild(div);
var defHeight1 = d.querySelector('#li1').offsetHeight;
var defHeight3 = d.querySelector('#li3').offsetHeight;
var defHeight5 = d.querySelector('#li5').offsetHeight;
var style = d.createElement('style');
style.innerHTML =':root {' +
'var-text-size: 30px;' +
'}' +
'body {' +
'font-size: var(text-size);' +
'}';
s.appendChild(style);
assert_true(d.querySelector('#li1').offsetHeight > defHeight1, 'Point 1: Element height should be changed');
assert_true(d.querySelector('#li3').offsetHeight > defHeight3, 'Point 2: Element height should be changed');
assert_true(d.querySelector('#li5').offsetHeight > defHeight5, 'Point 3: Element height should be changed');
}), 'A_06_01_01_T01');
</script>
</body>
</html>

View file

@ -29,7 +29,7 @@ div {
<div id="shadow-host"></div>
<script>
var shadowHost = document.getElementById('shadow-host');
var shadowRoot = shadowHost.createShadowRoot();
var shadowRoot = shadowHost.attachShadow({mode: 'open'});
var style = document.createElement('style');
style.innerHTML = 'div { background: red }';

View file

@ -37,7 +37,7 @@ test(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var div1 = d.createElement('div');
div1.innerHTML ='<span id="shd" class="invis">This is the shadow tree</span>';
@ -67,7 +67,7 @@ test(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var div1 = d.createElement('div');
div1.innerHTML ='<span id="shd" class="invis">This is the shadow tree</span>';

View file

@ -28,7 +28,7 @@ test(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
assert_equals(s.styleSheets.length, 0, 'There should be no style sheets');
}), 'A_06_00_03_T01');
@ -41,7 +41,7 @@ test(unit(function (ctx) {
d.body.appendChild(host);
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
assert_equals(s.styleSheets.length, 0, 'There should be no style sheets');
}), 'A_06_00_03_T02');
@ -54,7 +54,7 @@ test(unit(function (ctx) {
var host = d.createElement('div');
//Shadow root to play with
var s = host.createShadowRoot();
var s = host.attachShadow({mode: 'open'});
var style = d.createElement('style');
style.textContent = 'div {width: 50%;}';

Some files were not shown because too many files have changed in this diff Show more