- From: Philip Jägenstedt <notifications@github.com>
- Date: Thu, 05 Mar 2026 01:49:51 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/pull/1454/review/3895265530@github.com>
@foolip commented on this pull request.
> +
+<div algorithm>
+<p>The <dfn method for=ProcessingInstruction><code>hasAttribute(<var>name</var>)</code></dfn>
+method steps are:
+
+<ol>
+ <li><p>If <a>this</a>'s <a for=Node>node document</a> is an <a>HTML document</a>, then set
+ <var>name</var> to <var>name</var> in <a>ASCII lowercase</a>.
+
+ <li><p>Return true if <a>this</a>'s <a for=ProcessingInstruction>attribute map</a>[<var>name</var>]
+ <a for=set>exists</a>; otherwise false.
+</ol>
+</div>
+
+<div algorithm>
+<p>To <dfn>update attributes from data</dfn> for a {{ProcessingInstruction}} <a for=/>node</a> <var>pi</var>:
Yes, it was based on how this works in Chromium:
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/dom/processing_instruction.cc;l=120-146;drc=bc971aee7d328d1e886ba76adc540805ea480981
In WebKit it is similar:
https://github.com/WebKit/WebKit/blob/9af8ffff919a1a1478b8a43cef821adb49a4e6a1/Source/WebCore/dom/ProcessingInstruction.cpp#L99
https://github.com/WebKit/WebKit/blob/26d7991c939a41bbab5d01263900598b67220208/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp#L1556-L1574
In Gecko it's a little bit different, every attribute lookup uses an attribute parser and I can't tell if it exactly matches XML or not:
https://github.com/mozilla-firefox/firefox/blob/22d04b52b0eb8d9fa11bf8ede5ccc0243a07c5ba/dom/xml/XMLStylesheetProcessingInstruction.cpp#L92
https://github.com/mozilla-firefox/firefox/blob/afe51e48c9deecccbaf64a74d6f207456433df98/dom/xml/ProcessingInstruction.cpp#L77
https://github.com/mozilla-firefox/firefox/blob/22d04b52b0eb8d9fa11bf8ede5ccc0243a07c5ba/dom/base/nsContentUtils.cpp#L1842-L1943
The difference from what's already implemented is that we'd use the HTML parser in HTML documents, instead of unconditionally using the XML parser.
For compat, this difference means that existing content that creates a `<?xml-stylesheet href="..."?>` PI and moves it to an HTML document would take the HTML parser path instead of XML. For that to make a difference, I think that content would need to be invalid XML attribute syntax (like `<?xml-stylesheet href='...'?>`) and depends on it being broken (doing nothing) when being moved to HTML.
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/1454#discussion_r2888896111
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/dom/pull/1454/review/3895265530@github.com>
Received on Thursday, 5 March 2026 09:49:55 UTC