[Webkit-unassigned] [Bug 189934] No DOM API to instantiate an attachment for an img element

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Sep 24 16:05:21 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=189934

--- Comment #5 from Wenson Hsieh <wenson_hsieh at apple.com> ---
(In reply to mitz from comment #4)
> (In reply to Wenson Hsieh from comment #2)
> > (In reply to mitz from comment #0)
> > > Given an img element that’s not backed by an attachment, there’s currently
> > > no way to get it to be backed by an attachment. It would be useful to have a
> > > function on HTMLImageElement that one could call from JavaScript that would
> > > create a new attachment element, then call
> > > HTMLImageElement::setAttachmentElement to associate the attachment with the
> > > img. The caller could then use webkitAttachmentIdentifier to get the unique
> > > identifier of the attachment that’s been created.
> > 
> > Hm...I'm a bit more partial to adding a method to HTMLImageElement that
> > ensures an attachment element, and returns just the attachment identifier so
> > we don't need to worry about cases where a client could remove the
> > attachment element of the image afterwards via script.
> 
> I am not sure how your proposal differs from what I described in comment #0.
> Is it about the behavior when the img already has an attachment?

Ah, no, I misread your comment — I had thought that the method you proposed would return the attachment element it created, but it seems this is not the case.

On the topic of what happens if the img already has an attachment though...I think it should be a no-op? And we could call the method something like, "ensureAttachmentElement", which would return the attachment identifier of either an existing attachment element or a newly associated attachment element, if there was no existing attachment element.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180924/d0cb359e/attachment.html>


More information about the webkit-unassigned mailing list