2015-09-22 04:01:29 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<body>
|
|
|
|
<p>Test passes if you see a single 100px by 100px green box below.</p>
|
|
|
|
<my-host id="host1" style="background: green;"><div style="background: red;">FAIL</div></my-host>
|
|
|
|
<my-host id="host2" style="background: green;"><div slot="foo" style="background: red;">FAIL</div></my-host>
|
|
|
|
<my-host id="host3" style="background: red;"><div style="background: green;"></div><div slot="foo" style="background: red;">FAIL</div></my-host>
|
|
|
|
<my-host id="host4" style="background: red;"><div style="background: green;"></div></my-host>
|
|
|
|
<style>
|
|
|
|
|
|
|
|
my-host {
|
|
|
|
display: block;
|
|
|
|
width: 100px;
|
|
|
|
height: 25px;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
my-host > div {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
|
2015-09-22 08:17:09 +00:00
|
|
|
function forceLayout() {
|
|
|
|
if (window.internals)
|
|
|
|
internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks();
|
|
|
|
else
|
|
|
|
document.querySelector('p').getBoundingClientRect();
|
|
|
|
}
|
|
|
|
|
2015-09-22 04:01:29 +00:00
|
|
|
try {
|
|
|
|
var shadow1 = document.getElementById('host1').attachShadow({mode: 'open'});
|
|
|
|
shadow1.innerHTML = '<slot></slot>';
|
|
|
|
|
|
|
|
var shadow2 = document.getElementById('host2').attachShadow({mode: 'open'});
|
|
|
|
shadow2.innerHTML = '<slot name="foo"></slot>';
|
|
|
|
|
|
|
|
var shadow3 = document.getElementById('host3').attachShadow({mode: 'open'});
|
|
|
|
shadow3.innerHTML = '<slot name="foo"></slot>';
|
|
|
|
|
|
|
|
var shadow4 = document.getElementById('host4').attachShadow({mode: 'open'});
|
|
|
|
shadow4.innerHTML = 'FAIL';
|
|
|
|
|
2015-09-22 08:17:09 +00:00
|
|
|
forceLayout();
|
2015-09-22 04:01:29 +00:00
|
|
|
|
|
|
|
shadow1.removeChild(shadow1.firstChild);
|
2015-09-22 08:17:09 +00:00
|
|
|
forceLayout();
|
|
|
|
|
2015-09-22 04:01:29 +00:00
|
|
|
shadow2.firstChild.name = 'bar';
|
2015-09-22 08:17:09 +00:00
|
|
|
forceLayout();
|
|
|
|
|
Settings a reflected DOMString attribute to null should set it to the "null" string rather than the empty string
https://bugs.webkit.org/show_bug.cgi?id=153504
<rdar://problem/24353072>
Reviewed by Ryosuke Niwa.
Source/WebCore:
Settings a reflected DOMString attribute to null should set it to the "null"
string rather than the empty string:
- https://html.spec.whatwg.org/#reflecting-content-attributes-in-idl-attributes
- http://heycam.github.io/webidl/#es-DOMString
- http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring
Firefox and Chrome match the specification here.
This is causing a lot of W3C HTML reflection tests to fail on WebKit, e.g.:
- http://w3c-test.org/html/dom/reflection-text.html
No new tests, already covered by existing tests.
* bindings/scripts/CodeGeneratorJS.pm:
(JSValueToNative):
Call toString() instead of valueToStringWithNullCheck() for reflected
attributes. This way, null gets converted to the string "null", as
expected, instead of a null String object.
* html/HTMLInputElement.idl:
Dropping [TreatNullAs=NullString] IDL extended attribute for
input.defaultValue, as this is not present in the specification:
- https://html.spec.whatwg.org/#htmlinputelement
Without this change, assigning null to input.defaultValue would not
set to to the "null" string, as is expected.
* html/HTMLTextAreaElement.idl:
Dropping [TreatNullAs=NullString] IDL extended attribute for
textArea.defaultValue, as this is not present in the specification:
- https://html.spec.whatwg.org/#htmltextareaelement
Without this change, assigning null to textArea.defaultValue would not
set to to the "null" string, as is expected.
* html/HTMLTitleElement.idl:
Dropping [TreatNullAs=NullString] IDL extended attribute for
title.text, as this is not present in the specification:
- https://html.spec.whatwg.org/#htmltitleelement
Without this change, assigning null to title.text would not
set to to the "null" string, as is expected.
LayoutTests:
Update existing tests as a lot of them were expecting that setting
a reflected DOMString attribute to null would set it to the empty
string instead of the string "null".
* fast/dom/domstring-attribute-reflection-expected.txt:
* fast/dom/domstring-attribute-reflection.html:
* fast/dom/element-attribute-js-null-expected.txt:
* fast/dom/element-attribute-js-null.html:
* fast/dom/ping-attribute-dom-binding-expected.txt:
* fast/dom/ping-attribute-dom-binding.html:
* fast/forms/fieldset/fieldset-name-expected.txt:
* fast/forms/fieldset/fieldset-name.html:
* fast/forms/input-minmax-expected.txt:
* fast/forms/input-minmax.html:
* fast/forms/input-pattern-expected.txt:
* fast/forms/input-pattern.html:
* fast/forms/submit-form-attributes-expected.txt:
* fast/forms/submit-form-attributes.html:
* fast/shadow-dom/HTMLSlotElement-interface.html:
* fast/shadow-dom/NonDocumentTypeChildNode-interface-assignedSlot.html:
* fast/shadow-dom/shadow-layout-after-slot-changes.html:
* svg/dom/svg-element-attribute-js-null-expected.txt:
* svg/dom/svg-element-attribute-js-null.xhtml:
Canonical link: https://commits.webkit.org/171638@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195700 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-01-27 23:42:46 +00:00
|
|
|
shadow3.firstChild.removeAttribute("name");
|
2015-09-22 08:17:09 +00:00
|
|
|
forceLayout();
|
|
|
|
|
2015-09-22 04:01:29 +00:00
|
|
|
shadow4.insertBefore(document.createElement('slot'), shadow4.firstChild);
|
|
|
|
|
|
|
|
} catch (exception) {
|
|
|
|
document.body.appendChild(document.createTextNode(exception));
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|