W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2008

[whatwg] Disabled attribute for iframes

From: Greg Houston <gregory.houston@gmail.com>
Date: Thu, 14 Aug 2008 20:22:44 -0500
Message-ID: <29ae901a0808141822p694fb223g75c06a02b5b6d3ad@mail.gmail.com>
On Thu, Aug 14, 2008 at 7:50 PM, Jo?o Eiras <joao.eiras at gmail.com> wrote:
> Hi !
>
>> 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.
>>
>
>
> Well, if you need a workaround you can overlay an almost invisible element
> over your iframe, like
>
> function disableIframe(iframe){
>        if( iframe.__cover ){
>                var d = document.createElement('iframedisabler');
>                d.style.margin=0;
>                d.style.border=0;
>                d.style.position='absolute';
>                d.style.backgroundColor='white';
>                d.style.opacity = '0.01';
>                d.style.MozOpacity = '0.01';
>                d.style.WebkitOpacity = '0.01';
>                d.style.filter = 'alpha(opacity=1)';
>
>                iframe.__cover = d;
>        }
>        function get_xy(e){
>                var o = {x:0,y:0};
>                while( e ){
>                        o.x += e.offsetLeft;
>                        o.y += e.offsetTop;
>                        e = e.offsetParent;
>                }
>                return o;
>        }
>        var xy = get_xy(iframe);
>        d.style.height=iframe.offsetHeight+'px';
>        d.style.width=iframe.offsetWidth+'px';
>        d.style.top=xy.y+'px';
>        d.style.left=xy.x+'px';
>
>        document.body.appendChild(d);
> };
> function enableIframe(iframe){
>        if( iframe.__cover ){
>                document.body.removeChild(iframe.__cover);
>        }
> };
>

Yes, I had I mentioned that workaround in the original post. Ian had
mentioned that disabling an iframe might be a hassle for authors (
paraphrased by me) but compare the following with the current
workaround above:

myIframe.setAttribute("disabled", "disabled");

On Thu, Aug 14, 2008 at 7:56 PM, Neil Deakin <enndeakin at gmail.com> wrote:
> Is this related to the html5 drag and drop spec? It isn't clear from your
> earlier comment and this one. In the spec, mouse events don't fire at all
> during a drag. Implementations would fire dragover events in the parent or
> child frames as needed.
>
> Dragging columns widths probably wouldn't be done using the html5 d&d, but
> instead would need a mouse capturing api as previously described.

Neil, thanks for the clarification. So this may only apply to dragging
columns and resizing elements and not the HTML5 drag and drop.

- Greg
Received on Thursday, 14 August 2008 18:22:44 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:04 UTC