-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add getHTML() and the serializable concept #10139
Conversation
I'm not sure what this is - I do not get any errors when I build locally, using the build.sh script. Clues appreciated. |
This is due to whatwg/html-build#290. You have some invalid HTML around that line, but the Rust portion of the build step is fixing it up for you. PR preview doesn't run the Rust portion of the build step, so it fails. You can try applying whatwg/html-build#291 locally. Or you can stare really hard at (130197,76) to find the extra end tag. |
Ahh, thanks. Is there a way to run the local build without the Rust, so it matches what the preview does? Generally I try to make sure things build before I put up a PR, so I was disappointed to see this failure.
Thanks. 130197 is a blank line, and I had been staring at 130198 instead. Turns out the problem was on 130196. |
Looks like I'll be uploading a bunch of patches to try to find this one now... |
Side note, as I manually scan for mis-nested tags, it's nice that WHATWG fought for keeping HTML and not switching to XHTML. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review!
See the conversation here: whatwg/html#10139 But the TL;DR is that the `<template>` attribute corresponding to the declarative shadow root `serializable` attribute should be named in a parallel way to other DSD-related attributes, meaning it should start with `shadowroot*`. Bug: 41490936 Change-Id: I40ea496c22147bac7dcdfb74cd7bf4a3abae8be9
Also:
|
This is in progress, here and here.
Done: mdn/content#32731 |
The spec is landing: whatwg/html#10139 Bug: 41490936 Change-Id: Ia568d9f1adc9623298db6fd470383930fa5d9d9d
See the conversation here: whatwg/html#10139 But the TL;DR is that the `<template>` attribute corresponding to the declarative shadow root `serializable` attribute should be named in a parallel way to other DSD-related attributes, meaning it should start with `shadowroot*`. Bug: 41490936 Change-Id: I40ea496c22147bac7dcdfb74cd7bf4a3abae8be9
See the conversation here: whatwg/html#10139 But the TL;DR is that the `<template>` attribute corresponding to the declarative shadow root `serializable` attribute should be named in a parallel way to other DSD-related attributes, meaning it should start with `shadowroot*`. Bug: 41490936 Change-Id: I40ea496c22147bac7dcdfb74cd7bf4a3abae8be9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5375416 Commit-Queue: Di Zhang <[email protected]> Reviewed-by: Di Zhang <[email protected]> Auto-Submit: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1274374}
See the conversation here: whatwg/html#10139 But the TL;DR is that the `<template>` attribute corresponding to the declarative shadow root `serializable` attribute should be named in a parallel way to other DSD-related attributes, meaning it should start with `shadowroot*`. Bug: 41490936 Change-Id: I40ea496c22147bac7dcdfb74cd7bf4a3abae8be9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5375416 Commit-Queue: Di Zhang <[email protected]> Reviewed-by: Di Zhang <[email protected]> Auto-Submit: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1274374}
I can't find a way to unresolve the comment and it's not relevant to this PR anymore since it's been removed, but if Chrome is using HTMLString as a return type it's likely doing nothing more than being a DOMString, or worse case is slower. For context HTMLString comes from Trusted Types and it's an alias for |
So this PR has been changed to do |
The spec is landing: whatwg/html#10139 Bug: 41490936 Change-Id: Ia568d9f1adc9623298db6fd470383930fa5d9d9d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5378423 Auto-Submit: Mason Freed <[email protected]> Reviewed-by: Di Zhang <[email protected]> Commit-Queue: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1275958}
The spec is landing: whatwg/html#10139 Bug: 41490936 Change-Id: Ia568d9f1adc9623298db6fd470383930fa5d9d9d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5378423 Auto-Submit: Mason Freed <[email protected]> Reviewed-by: Di Zhang <[email protected]> Commit-Queue: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1275958}
The spec is landing: whatwg/html#10139 Bug: 41490936 Change-Id: Ia568d9f1adc9623298db6fd470383930fa5d9d9d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5378423 Auto-Submit: Mason Freed <[email protected]> Reviewed-by: Di Zhang <[email protected]> Commit-Queue: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1275958}
I think HTMLString is only relevant for input which is why It seems this PR needs rebasing. I think we should also resolve #10211. And where you wrote "element or shadow root" you didn't update the variable name. There might be more errors, I didn't read through it all again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest changes left things in a bad state, with "DOM parsing and serialization" only containing parsing spec text plus serialization IDL, and the serialization spec text and domintro still far away in a different section.
It was explicitly not my intention to make @mfreed7 resolve this disagreement between the editors in this PR by commenting on #10139 (comment), and I'm sad that my comment there was used to delay landing this. I explicitly said I'd like to work on that as a followup.
To compensate, I took it on myself to do the remaining rearranging to get things into a hopefully-agreeable state, in 1619131.
While there I got nerd-sniped into improving the domintro, which previously didn't follow our existing conventions and didn't explain the options at all. If someone could check that I summarized the behavior correctly, that would be appreciated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for making these edits! Modulo two comments, this LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@annevk want to do a final check? Also I think you should merge whatwg/dom#1256 first? |
Your opinion on this apparently differs, but I don't think delaying this by a couple days is a big deal, given that it might make blame a lot more useful. I also didn't think @mfreed7 would act on the comment given what you had written there. I wanted to wait with landing until I had some conversation with you about it. I think the changes you made make sense, though Simon just spotted a bigger problem. |
Corresponding HTML PR & issue: whatwg/html#10139 & whatwg/html#8867.
Thanks everyone! |
…rialization, a=testonly Automatic update from web-platform-tests Add a test of the ordering of getHTML serialization This adds a test to verify that the serialized version of a shadow root: 1. has the `<template shadowroot>` first, before any children, regardless of where the initial DSD content put them. 2. has the various shadowroot* attributes in a well defined order, again regardless of where the initial DSD put them. This came from a comment on the spec PR, here: whatwg/html#10139 (comment) (Note that Github currently doesn't properly handle links to "Resolved" conversations, and the above conversation is resolved. So I guess trust me that the request was to add testing for this case!) Bug: 41490936 Change-Id: I7866b61b768f645d61142a1fd4a9490ee0732dc2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5405665 Reviewed-by: David Baron <[email protected]> Commit-Queue: Mason Freed <[email protected]> Auto-Submit: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1279973} -- wpt-commits: 6a072aeb9fcbaa56cab5e168cba7b706268c4d05 wpt-pr: 45415
https://bugs.webkit.org/show_bug.cgi?id=271343 rdar://125513986 Reviewed by Ryosuke Niwa. This implements whatwg/html#10139 as amended by whatwg/html#10260. This also changes the way a shadow root is serialized to avoid creating a template element. The API is guarded by DeclarativeShadowRootsSerializerAPIsEnabled just in case there is a need to disable it without removing the code. Thanks to Chris Dumez for his help with Vector<RefPtr<ShadowRoot>>. WPT tests are synchronized up to and including this commit: web-platform-tests/wpt@dd2e51d This also adjusts the copyright lines to match the commit log for the relevant files. * LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-repeats-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-repeats.html: * LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/gethtml-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/gethtml-ordering-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/gethtml-ordering.html: Added. * LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/gethtml.html: Added. * LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/gethtml.tentative-expected.txt: Removed. * LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/gethtml.tentative.html: Removed. * LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/w3c-import.log: * LayoutTests/tests-options.json: * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: * Source/WebCore/CMakeLists.txt: * Source/WebCore/DerivedSources-input.xcfilelist: * Source/WebCore/DerivedSources-output.xcfilelist: * Source/WebCore/DerivedSources.make: * Source/WebCore/Headers.cmake: * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/dom/Element.cpp: (WebCore::Element::getHTML const): * Source/WebCore/dom/Element.h: * Source/WebCore/dom/GetHTMLOptions.h: Added. * Source/WebCore/dom/GetHTMLOptions.idl: Added. * Source/WebCore/dom/InnerHTML.idl: * Source/WebCore/dom/ShadowRoot.cpp: (WebCore::ShadowRoot::ShadowRoot): (WebCore::ShadowRoot::getHTML const): (WebCore::ShadowRoot::cloneNodeInternal): * Source/WebCore/dom/ShadowRoot.h: * Source/WebCore/dom/ShadowRoot.idl: * Source/WebCore/dom/ShadowRootInit.h: * Source/WebCore/dom/ShadowRootInit.idl: * Source/WebCore/editing/MarkupAccumulator.cpp: (WebCore::MarkupAccumulator::MarkupAccumulator): (WebCore::MarkupAccumulator::shouldIncludeShadowRoots const): (WebCore::MarkupAccumulator::includeShadowRoot const): (WebCore::MarkupAccumulator::serializeNodesWithNamespaces): (WebCore::MarkupAccumulator::replacementElement): * Source/WebCore/editing/MarkupAccumulator.h: (WebCore::MarkupAccumulator::MarkupAccumulator): * Source/WebCore/editing/markup.cpp: (WebCore::serializeFragment): * Source/WebCore/editing/markup.h: (WebCore::serializeFragment): * Source/WebCore/html/HTMLAttributeNames.in: * Source/WebCore/html/HTMLTemplateElement.cpp: (WebCore::HTMLTemplateElement::attachAsDeclarativeShadowRootIfNeeded): * Source/WebCore/html/HTMLTemplateElement.idl: * Source/WebCore/html/parser/HTMLConstructionSite.cpp: (WebCore::HTMLConstructionSite::insertHTMLTemplateElement): * Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp: (WebCore::LegacyWebArchive::create): Canonical link: https://commits.webkit.org/277374@main
I2S: - https://groups.google.com/a/chromium.org/g/blink-dev/c/T4jcCXRkwB8/m/GD81-4bNAAAJ Spec: - whatwg/html#10139 - whatwg/dom#1256 Fixed: 41490936 Change-Id: Ie9b52d5d7a5aa626f1d9f96326c2d4826e11874f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5427272 Auto-Submit: Mason Freed <[email protected]> Reviewed-by: Chris Harrelson <[email protected]> Commit-Queue: Chris Harrelson <[email protected]> Cr-Commit-Position: refs/heads/main@{#1285896}
…rialization, a=testonly Automatic update from web-platform-tests Add a test of the ordering of getHTML serialization This adds a test to verify that the serialized version of a shadow root: 1. has the `<template shadowroot>` first, before any children, regardless of where the initial DSD content put them. 2. has the various shadowroot* attributes in a well defined order, again regardless of where the initial DSD put them. This came from a comment on the spec PR, here: whatwg/html#10139 (comment) (Note that Github currently doesn't properly handle links to "Resolved" conversations, and the above conversation is resolved. So I guess trust me that the request was to add testing for this case!) Bug: 41490936 Change-Id: I7866b61b768f645d61142a1fd4a9490ee0732dc2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5405665 Reviewed-by: David Baron <[email protected]> Commit-Queue: Mason Freed <[email protected]> Auto-Submit: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1279973} -- wpt-commits: 6a072aeb9fcbaa56cab5e168cba7b706268c4d05 wpt-pr: 45415
Corresponding HTML PR & issue: whatwg/html#10139 & whatwg/html#8867.
Add
getHTML()
and theserializable
concept for shadow roots. See #8867 (comment) for the rough consensus on how this should work, plus the few comments below that with modifications.getHTML()
,setHTMLUnsafe()
, andparseHTMLUnsafe()
methods are missing mdn/content#32731See the corresponding DOM spec PR here: whatwg/dom#1256
/canvas.html ( diff )
/dynamic-markup-insertion.html ( diff )
/index.html ( diff )
/indices.html ( diff )
/infrastructure.html ( diff )
/interaction.html ( diff )
/parsing.html ( diff )
/scripting.html ( diff )
/semantics.html ( diff )