-
Notifications
You must be signed in to change notification settings - Fork 143
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
Ensure custom HTML attributes are passed-through #1605
Ensure custom HTML attributes are passed-through #1605
Conversation
element.replaceWith(placeholder); | ||
return placeholder; | ||
} | ||
|
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.
As far as I can tell these are somewhat duplicated by the same thing in core (previously known as NodeRange
).
@@ -25,57 +26,84 @@ export interface EmberHTML { | |||
implicitTestStyles?: Node; | |||
} | |||
|
|||
class NodeRange { |
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.
I think there are multiple bugs in the original implementation. For example, we never updated this.end
when we insert something, so the clear code probably does not work as intended.
@@ -66,7 +66,7 @@ export class HTMLEntrypoint { | |||
} | |||
|
|||
private handledStyles() { | |||
let styleTags = [...this.dom.window.document.querySelectorAll('link[rel="stylesheet"]')] as HTMLLinkElement[]; | |||
let styleTags = [...this.dom.window.document.querySelectorAll('link[rel*="stylesheet"]')] as HTMLLinkElement[]; |
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.
This fixes a bug where previously rel="prefetch stylesheet"
(or similar) in the compat HTML did not get picked up.
fc3a160
to
6602c80
Compare
This ensures user-defined attributes on `<script>` and `<link>` tags in the compat `index.html` are propagated to the final HTML file. Fixes embroider-build#456 Co-authored-by: Jan Bobisud <[email protected]>
6602c80
to
38c269d
Compare
newTag.src = src; | ||
let newTag = makeTag(this.end.ownerDocument, { from: this.target, attributes: { src } }); | ||
normalizeScriptTag(newTag); | ||
|
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.
It seems like we do need both the changes in ember-html.ts
as well as in this file. (@ef4 was pondering if we needed both in the other PR). I tried removing these changes, but the new tests I added started failing on the <link>
tags, even though the <script>
tags were fine. I did not investigate further.
What failing check ?_____? |
This ensures user-defined attributes on
<script>
and<link>
tags in the compatindex.html
are propagated to the final HTML file. Replaces #588Fixes #456