IE6 "standards" mode and CSS clip

G

Gary McPherson

I've observed some very unhelpful behaviour from IE6 when trying to
manipulate the clip values of an element. If the values are delimited
using commas (which I discovered was necessary for CSS validation), then
IE fails to acknowledge the clip value at all. I tried moving the
definitions from inline style attributes to a stylesheet, but it behaves
in the same way, even stripping the rule out of the cssText property.

Following some more investigation, I discovered that the problem is only
exhibited when standards-compliant mode is enabled. Hmmm, let's see...
W3C standards for clip declaration require comma-delimited clip values.
IE in so-called standards-compliant mode completely ignores any such
declaration, yet it happily processes them when in quirks mode - go figure!

Essentially, this will validate as CSS, but breaks IE:

#myElem { clip: rect(5px,25px,25px,5px); }
style="clip: rect(5px,25px,25px,5px);"

while this will work but not validate as CSS:

#myElem { clip: rect(5px 25px 25px 5px); } or
style="clip: rect(5px 25px 25px 5px);"

Curiously, I tried making up a rule for an arbitrary "iclip" value,
which IE retrieves just fine and I could always parse out to set the
real clip values. Of course, it wouldn't validate as CSS, but it
indicates that IE has a specific expectation of the clip string format
that doesn't match the W3C standard. I've Googled thoroughly for this,
but haven't found any instances relating to this particular bug, so I'm
hoping someone here can help me out. I can knock up a demo page if
anyone needs a live example.

Thanks in advance,

Gary
 
G

Gary McPherson

brucie said:
its a design feature
You're so right.
with what? i couldn't find a question.

Correct again. I guess that's what happens when you work through the
nite on one annoying bug instead of sleeping like normal people. Well,
the questions I SHOULD have asked are:

a) Has anyone here experienced this behaviour before?

b) Other than setting IE to Quirks mode and rewriting all my code to
handle it, any suggestions on how to get around it?

Many thanks,

Gary.
 
B

brucie

Correct again. I guess that's what happens when you work through the
nite on one annoying bug instead of sleeping like normal people. Well,
the questions I SHOULD have asked are:

a) Has anyone here experienced this behaviour before?

i've been having a fiddle and the only browser i can get clip to work
with is moz. a URL would be nice.
b) Other than setting IE to Quirks mode and rewriting all my code to
handle it, any suggestions on how to get around it?

don't use it
 
G

Gary McPherson

brucie said:
i've been having a fiddle and the only browser i can get clip to work
with is moz. a URL would be nice.

As you wish... Knocked up an example page which should adequately
demonstrate the problem here:

http://www.ingenyus.net/experiments/cliptest.htm
don't use it

Yeah, but who wants to take the easy option, eh? :) To be honest, it's a
rather important part of that page, but I DO have the old code which was
originally written to work with IE in Quirks mode, so I could always
"retrograde" it if needs be. I guess it's just a personal thing now -
having spent a literal day on it, I just don't want to let it beat me...
 
G

Gary McPherson

brucie said:
doesn't work with IE6, opera7.23 or moz 1.5

Hmmmmmmm... Cheers for letting me know. Surprised it doesn't work in
Moz, it's happy in Firebird 0.7. Well, I think I'll concede that it's
won the battle for now and resume the war later. Appreciate your time on
this, many thanks!

Gary
 
D

DU

Gary said:
I've observed some very unhelpful behaviour from IE6 when trying to
manipulate the clip values of an element. If the values are delimited
using commas (which I discovered was necessary for CSS validation), then
IE fails to acknowledge the clip value at all. I tried moving the
definitions from inline style attributes to a stylesheet, but it behaves
in the same way, even stripping the rule out of the cssText property.

Following some more investigation, I discovered that the problem is only
exhibited when standards-compliant mode is enabled. Hmmm, let's see...
W3C standards for clip declaration require comma-delimited clip values.
IE in so-called standards-compliant mode completely ignores any such
declaration, yet it happily processes them when in quirks mode - go figure!

Essentially, this will validate as CSS, but breaks IE:

#myElem { clip: rect(5px,25px,25px,5px); }
style="clip: rect(5px,25px,25px,5px);"

while this will work but not validate as CSS:

#myElem { clip: rect(5px 25px 25px 5px); } or
style="clip: rect(5px 25px 25px 5px);"

http://www.w3.org/TR/CSS21/changes.html#q82

I use without comma and it works flawlessly in Opera 7.x, MSIE 6, NS 7.x
and Mozilla 1.x.

DU
 
G

Gary Mc

brucie said:
i wish someone would post a URL demonstrating clip working in a browser
other than moz

It will work with absolutely-positioned elements in IE, as far as I've
discovered. Sorry for the iffy post this morning - I guess I shouldn't
have tried making that demo page without getting some sleep first. I've
fixed it now, so you should be able to see the difference in IE.

http://www.ingenyus.net/experiments/cliptest.htm

Gary
 
M

Mark Parnell

it doesn't work with IE6.0.2800.1106.xpsp2.030422-1633 or opera 7.23.
works with moz1.5

That's strange. Here I get (the boxes are in different places and
different sizes in each browser but as for the alerts):

Clip 1 works in Moz1.5 and IE6.0.2800.1106
Clip 2 works in Moz1.5 and O7.23

All assuming Javascript is enabled, of course.
 
B

brucie

That's strange. Here I get (the boxes are in different places and
different sizes in each browser but as for the alerts):

Clip 1 works in Moz1.5 and IE6.0.2800.1106
Clip 2 works in Moz1.5 and O7.23

All assuming Javascript is enabled, of course.

IE and moz have got JS enabled and f&%#ed if i'm going to enable JS so
CSS works for opera, i may as well use NS4.x
 
M

Mark Parnell

IE and moz have got JS enabled and f&%#ed if i'm going to enable JS so
CSS works for opera, i may as well use NS4.x

Are you saying that Opera requires JS to be enabled for CSS to work?
That's news to me.
 
B

brucie

IE and moz have got JS enabled and f&%#ed if i'm going to enable JS so
CSS works for opera, i may as well use NS4.x

it still doesn't work with opera with JS anyway

opera 7.23.3227
http://moreshit.bruciesusenetshit.info/screencap-opera01.png [4k]

moz1.5 20031007
http://moreshit.bruciesusenetshit.info/screencap-moz01.png [2k]

IE6.0.2800.1106.xpsp2.030422-1633
http://moreshit.bruciesusenetshit.info/screencap-ie01.png [2k]

IE6.0.2800.1106.xpsp2.021108-1929
http://moreshit.bruciesusenetshit.info/screencap-ie02.png [2k]
 
M

Mark Parnell

no, you said that. "All assuming Javascript is enabled, of course."

I read your comment on its own merits, rather than in the context of the
thread. On its own, "f&%#ed if i'm going to enable JS so CSS works for
opera" sounds like what I thought you meant. In the context of the
thread, it makes more sense. :)
 
G

Gary Mc

brucie said:
it still doesn't work with opera with JS anyway

opera 7.23.3227
http://moreshit.bruciesusenetshit.info/screencap-opera01.png [4k]

moz1.5 20031007
http://moreshit.bruciesusenetshit.info/screencap-moz01.png [2k]

IE6.0.2800.1106.xpsp2.030422-1633
http://moreshit.bruciesusenetshit.info/screencap-ie01.png [2k]

IE6.0.2800.1106.xpsp2.021108-1929
http://moreshit.bruciesusenetshit.info/screencap-ie02.png [2k]

That first IE screenshot is very puzzling. The second IE and Moz shots
are exactly as I get on my own system, but to see such a disparity
between different builds of IE6 - that's impressive even for M$! What's
even more curious is that I have that same *1633 build and it displays
the same as on your second shot. I also tested it with a *2800-1106
build with identical results. Perhaps it's just an isolated case, but
who knows? Support for clipping is obviously still very much inadequate
across browsers...

Gary
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top