htmlwebkitapple-documentation

What is HTMLAttachmentElement?


After checking out Apple Developer documentation, I found that Webkit has a DOM HTMLAttachmentElement interface. I found it here: https://developer.apple.com/documentation/webkitjs/htmlattachmentelement

I'm curious, what tag does this interface correspond to? I know it probably isn't an <attachment> element, since that doesn't exist, but the documentation is extremely vague (and likely auto generated) and doesn't tell me what tag/element that this is for.


Solution

  • HTMLAttachmentElement is a subclass of HTMLElement, specialized for the <attachment>. Actually the attchment element like <attachment src="something" id="foo"></attachment> element was never supported by W3C.

    let el = document.createElement("attachment");
    console.log(el.constructor.name);  // "HTMLAttachmentElement" (in WebKit only)
    

    outside WebKit, document.createElement("attachment") just gives you a generic HTMLElement