NEW273587
Warning when invalid namespace
https://bugs.webkit.org/show_bug.cgi?id=273587
Summary Warning when invalid namespace
Luke Warlow
Reported 2024-05-01 15:52:06 PDT
If an API such as createElementNS is called with an invalid namespace, it would be good to warn about this in web inspector. Namespace URIs while open-ended by design are generally intended to be 1 of 3 (for elements) namespaces see https://developer.mozilla.org/en-US/docs/Web/API/Document/createElementNS#important_namespace_uris For an example of where this could be useful for developers, if the browser logged a warning, then Angular might never have had a broken MathML intergration (see https://github.com/angular/angular/pull/55622). I'm unaware how frequent this warning would fire for "legitimate" scenarios, but it seems at least for w3.org or w3c.org (an easy mistake to make) namespaces it would be useful.
Attachments
Ryan Christian
Comment 1 2024-05-01 16:15:00 PDT
To add a similar issue case: I've been refactoring another JS framework, switching it over to exclusively use `createElementNS` (rather than a mix of `createElement` & `createElementNS`), and had mistyped the xhtml namespace. This largely worked without issue, but the test suite returned a few odd errors as I discovered an `Element` instance was being returned, rather than the expected `HTMLElement` instance, due to this typo. Simple fix of course, but not the easiest to spot: ```diff -http://www.w3c.org/1999/xhtml +http://www.w3.org/1999/xhtml ``` Having a warning for "incorrect" namespaces containing "w3" or "w3c" as mentioned would be much appreciated.
Radar WebKit Bug Importer
Comment 2 2024-05-08 15:53:16 PDT
Note You need to log in before you can comment on or make changes to this bug.