Bug 239610

Summary: [model] How can we query availability of <model> reliably?
Product: WebKit Reporter: Thomas Kumlehn <pixelpartner>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WORKSFORME    
Severity: Enhancement CC: dino, graouts, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Mac (Apple Silicon)   
OS: macOS 12   

Description Thomas Kumlehn 2022-04-21 09:59:36 PDT
If the HTML model feature is deactivated, document.createElement("model") neither triggers an exception, nor does it return HTMLUnknownElement like other browsers do.
On all Safari platforms.
What would be a valid way to use Javascript to query this feature reliably? I assume, the standards conform way should be to return HTMLUnknownElement.
Comment 1 Antoine Quint 2022-04-22 02:54:18 PDT
I believe this does the trick:

function supportsModel () {
    return "HTMLModelElement" in window;
}
Comment 2 Thomas Kumlehn 2022-04-22 03:18:20 PDT
Thank you very much
Comment 3 Radar WebKit Bug Importer 2022-04-28 10:00:18 PDT
<rdar://problem/92470985>