Bug 273587
| Summary: | Warning when invalid namespace | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Luke Warlow <lwarlow> |
| Component: | Web Inspector | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Enhancement | CC: | inspector-bugzilla-changes, rchristian, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 17 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Luke Warlow
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Ryan Christian
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
<rdar://problem/127771083>