[whatwg] Disabled attribute for iframes

On Fri, Aug 15, 2008 at 2:00 PM, Ojan Vafai <ojan.vafai at gmail.com> wrote:
> On Thu, Aug 14, 2008 at 4:14 PM, Ian Hickson <ian at hixie.ch> wrote:
>> On Thu, 14 Aug 2008, Greg Houston wrote:
>>>
>>> 1. You have a fluid layout where the columns are resizable via
>>> javascript by dragging the borders. The content of one of the columns is
>>> an iframe. You begin dragging the border between it and the column to
>>> the left, but as soon as the cursor goes over the iframe, the dragging
>>> functionality stops because you have now entered the context of the
>>> iframe. Thus it becomes impossible or at the very least very difficult
>>> to resize the column containing it.
>>
>> This seems like a bug. It seems like we would want to address this
>> directly rather than requiring authors to disable iframes when doing drags
>> (especially since that wouldn't help with things like plugins or
>> whatever). Wouldn't the better solution be to provide some sort of
>> mechanism to say that while the mouse button is down, all the mouse move
>> events should go to the element that got the mousedown event?
>
> setCapture/releaseCapture is how IE supports this. Seems to work well
> with iframes. It even deals with event coordinates in the expected way
> (e.g. clientX, clientY are relative to the document that the captured
> element is in instead of the document of the iframe).
>
> Seems like a fine addition to HTML5.
>
> Some sample code:
> <div onmousemove="document.getElementById('res').innerHTML+=event.clientX
> + '|' + event.clientY + ' '" onmousedown="this.setCapture()"
> onmouseup="document.releaseCapture()">foo</div>
> <iframe></iframe>
> <div id="res"></div>

I tested Ojan's suggestion in IE7 with both iframes and Flash and it
works perfectly. I too believe setCapture and releaseCapture would be
excellent additions to HTML5.

- Greg

Received on Friday, 15 August 2008 18:02:09 UTC