Commit graph

12 commits

Author SHA1 Message Date
Sam Atkins
336ccdb5f1 LibWeb/XML: Treat declared namespaces as valid for attributes
Previously if we encountered any attributes with a namespace other than
`xml` or `xmlns`, we treated it as a parse error. Now, allow it as long
as it's been declared in the current context.

We also handle errors more gracefully - instead of exploding if setting
the namespace fails, treat it as an error and carry on.
2025-04-15 09:39:19 +01:00
Sam Atkins
c99aac4bf0 LibWeb/XML: Make namespace getter reject invalid qualified names
Names like ":hi", "wow:", or "a🅱️c" are invalid, so early-out instead
of searching our namespace stack for matching prefixes.

And also rename the function because it's relevant to attributes too.
2025-04-15 09:39:19 +01:00
Andreas Kling
f1914893e9 LibJS+LibWeb: Remove more uses of DeprecatedFlyString 2025-03-24 22:27:17 +00:00
Tim Ledbetter
96fc840b03 LibXML: Associate prefixed elements with the correct namespace
Previously, any xmlns attributes with an associated prefix were ignored.
2025-02-25 15:02:35 +01:00
Timothy Flynn
85b424464a AK+Everywhere: Rename verify_cast to as
Follow-up to fc20e61e72.
2025-01-21 11:34:06 -05:00
Lucien Fiorini
ae8033b80f LibWeb: Rename abbreviated variable name 2024-12-09 09:13:24 +00:00
Lucien Fiorini
0c24c9150a LibWeb: Parse the qualified name of XML dom elements correctly 2024-12-09 09:13:24 +00:00
Milo van der Tier
5deb2b4cad LibWeb: Do not give the HTML namespace to elements when parsing XML
While the code that did this referred to the HTML spec, other browsers
appear not to have this behavior when parsing XML, and it breaks a WPT
subtest.

This change does not appear to break any tests, and fixes 1 WPT subtest.
2024-11-27 17:10:32 +01:00
Timothy Flynn
488034477a Revert "LibWeb: Set doctype node immediately while parsing XML document"
This reverts commit cd446e5e9c.

This broke about 20k WPT subtests, all related to XML parsing. See:
https://wpt.fyi/results/html/the-xhtml-syntax/parsing-xhtml-documents?diff=&filter=ADC&run_id=5154815472828416&run_id=5090731742199808
2024-11-20 19:11:56 -05:00
Andreas Kling
cd446e5e9c LibWeb: Set doctype node immediately while parsing XML document
Instead of deferring it to the end of parsing, where scripts that
were expecting to look at the doctype may have already run.
2024-11-20 16:10:57 +01:00
Shannon Booth
f87041bf3a LibGC+Everywhere: Factor out a LibGC from LibJS
Resulting in a massive rename across almost everywhere! Alongside the
namespace change, we now have the following names:

 * JS::NonnullGCPtr -> GC::Ref
 * JS::GCPtr -> GC::Ptr
 * JS::HeapFunction -> GC::Function
 * JS::CellImpl -> GC::Cell
 * JS::Handle -> GC::Root
2024-11-15 14:49:20 +01:00
Timothy Flynn
93712b24bf Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00