.innerText throws on a blocklist of elements |
|||||
Issue descriptionOur code throws for a subset of elements when you try to use the .innerText setter (namely, void elements and a few others like <basefont>). This appears to be a result of reverse-engineering the earlier IE implementation of the feature, as .innerText was undocumented at the time. The current spec doesn't have a blocklist, Edge doesn't have the old IE behavior (and Firefox never did), and .textContent works on all of those elements, so it seems like we should just go ahead and remove the blocklist, and let the setter work on all elements. Discussion: https://github.com/whatwg/html/issues/2222
,
Jan 10 2017
outerText has a similar check in Chromium FWIW, but it seems the spec for outerText setting isn't there yet: https://github.com/whatwg/html/issues/668
,
Jan 10 2017
Let's wait for the upstream web platform tests to land.
,
Jan 10 2017
Tests have landed: - http://w3c-test.org/innerText/setter.html - http://w3c-test.org/domparsing/createContextualFragment.html (no tests for outerText though.)
,
Jan 18 2017
,
Feb 18 2017
Hi dominicc@ Seems there are three files [1] will use ieForbidsInsertHTML() to determine whether to place the end tag or not. I'm not pretty sure how to change these files in Chromium code style, seems I have some choice: 1. Change HTMLElement::ieForbidsInsertHTML() to HTMLElement::cannotHaveEndTagWhenSerialising(), and keep the reference between these three files and the function. 2. Remove HTMLElement::ieForbidsInsertHTML(), for each place need to know whether it's a void element, use a big if statement to check it. 3. Like WebKit, remove HTMLElement::ieForbidsInsertHTML() entirely, use an array and a for loop in each file to check it. So in Chromium project, which type of change you will choose? Thanks in advance [1]: third_party/WebKit/Source/web/WebFrameSerializerImpl.cpp third_party/WebKit/Source/core/editing/serializers/MarkupFormatter.cpp third_party/WebKit/Source/core/editing/serializers/MarkupAccumulator.cpp
,
Feb 20 2017
ratsunny@ is working on this.
,
Feb 22 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/7a581007693d6b482158d03cd6eac849da99bb76 commit 7a581007693d6b482158d03cd6eac849da99bb76 Author: ratsunny <ratsunny@gmail.com> Date: Wed Feb 22 09:50:38 2017 Remove blacklist on .innerHTML and .outerHTML The blacklist was stored in HTMLElement::ieForbidsInsertHTML(), used to disallow set inner/outerHTML on these elements and determine whether the tag should be serailized with end tag or not. The current spec doesn't have any blocklist on them, so the blocklists on .innerHTML, .outerHTML and createContextualFragment() are all removed in this change. During the serialization, the spec [1] have a list of tag names which should skip the end tag, the serializers now using it instead of using the HTMLElement::ieForbidsInsertHTML(). This commit also fix a bug in serializeNodesWithNamespaces(), which always append the end tag even it is serialized as html document and the tag is in the list mentioned above. Around 180 failed tests will be passed after this change. [1] https://www.w3.org/TR/DOM-Parsing/ BUG= 679069 Review-Url: https://codereview.chromium.org/2707973002 Cr-Commit-Position: refs/heads/master@{#451961} [delete] https://crrev.com/c5608a34fd0112511e9165179a91cdd9277518b2/third_party/WebKit/LayoutTests/external/wpt/domparsing/createContextualFragment-expected.txt [modify] https://crrev.com/7a581007693d6b482158d03cd6eac849da99bb76/third_party/WebKit/LayoutTests/external/wpt/html/syntax/serializing-html-fragments/serializing-expected.txt [modify] https://crrev.com/7a581007693d6b482158d03cd6eac849da99bb76/third_party/WebKit/LayoutTests/external/wpt/innerText/setter-expected.txt [delete] https://crrev.com/c5608a34fd0112511e9165179a91cdd9277518b2/third_party/WebKit/LayoutTests/fast/dom/HTMLElement/ie-forbids-insert-html-expected.txt [delete] https://crrev.com/c5608a34fd0112511e9165179a91cdd9277518b2/third_party/WebKit/LayoutTests/fast/dom/HTMLElement/ie-forbids-insert-html.html [modify] https://crrev.com/7a581007693d6b482158d03cd6eac849da99bb76/third_party/WebKit/Source/core/editing/serializers/MarkupAccumulator.cpp [modify] https://crrev.com/7a581007693d6b482158d03cd6eac849da99bb76/third_party/WebKit/Source/core/editing/serializers/MarkupFormatter.cpp [modify] https://crrev.com/7a581007693d6b482158d03cd6eac849da99bb76/third_party/WebKit/Source/core/editing/serializers/Serialization.cpp [modify] https://crrev.com/7a581007693d6b482158d03cd6eac849da99bb76/third_party/WebKit/Source/core/html/HTMLElement.cpp [modify] https://crrev.com/7a581007693d6b482158d03cd6eac849da99bb76/third_party/WebKit/Source/core/html/HTMLElement.h [modify] https://crrev.com/7a581007693d6b482158d03cd6eac849da99bb76/third_party/WebKit/Source/web/WebFrameSerializerImpl.cpp
,
Feb 22 2017
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by domenic@chromium.org
, Jan 6 2017Components: Blink>DOM