[jQuery] Re: IE6 Stylesheet Woes

2007-10-09 Thread Andy Kent

Thanks a heap for your help James, after lots of trial and error I
managed to track down the source of the problem.

It's a very curious IE issue, your examples work fine provided you
don't try to access document.stylesheets first, if you do then that
seems to kick IE off on a parsing spree.

Oh well, all fixed now, thanks for your help.

Andy.


On 8 Oct, 17:03, James Dempster [EMAIL PROTECTED] wrote:
 Thats strange, I've added lots of strange chars and it still works ok for
 me.

 Screenshots.http://www.jdempster.com/public/jss/ie6.pnghttp://www.jdempster.com/public/jss/ie7.pnghttp://www.jdempster.com/public/jss/ff2.png

 I did test it in more but these will do for now. Can any one else check
 their IE?

 /James

 On 10/8/07, Andy Kent [EMAIL PROTECTED] wrote:



  This has the same issue I'm afraid.

  It works for all those examples as IE thinks they are valid. Give
  something like div~p:first a go though and I you get the selector
  replaced with the string 'UNKOWN' in the innerHTML source code.

  Thanks for the attempt but sill no prize yet!

  :( *tears*

  Andy.

  On 8 Oct, 14:43, James Dempster [EMAIL PROTECTED] wrote:
   I've pinched some code from Christian Bach (http://lovepeacenukes.com/
   jquery/ie6cssfix/) and put it into it's own test case. Tested it on
   Win IE 6/7, FF 1.5/2, Safari3, Opera 9 and they all showed the same
   results.

   Test it out. Hopefully it can help
  .http://www.jdempster.com/public/jss/js_css.html

   On Oct 8, 11:29 am, Andy Kent [EMAIL PROTECTED] wrote:

Unfortunately after some experimentation this method still appears to
yield 'UNKNOWN' in place of selectors that are not understood by IE.

Poo.

On 8 Oct, 11:15, Andy Kent [EMAIL PROTECTED] wrote:

 Thanks Mike, that's a huge help and sounds like it will solve my
 problem perfectly. I will have a play now.

 Should jQuery not be clever enough to handle this internally when
  you
 call .text() on a style element?
 Is it worth filing as a bug do you think?

 Andy.

 On 8 Oct, 11:07, Michael Geary [EMAIL PROTECTED] wrote:

  Andy, you can read or write the content of an IE stylesheet with:

 $('style')[n].styleSheet.cssText

  where n is the index of the stylesheet you want.

  Instead of browser detection, I test for the presence of that
  .styleSheet
  property, and then either use .styleSheet.cssText or .text()
  depending.

  Some example non-jQuery code that I use (shows writing and
  replacing but not
  reading):

  function addStyle( css ) {
  var style = document.createElement( 'style' );
  style.type = 'text/css';
  head.appendChild( style );
  if( style.styleSheet )
  style.styleSheet.cssText = css;
  else
  style.appendChild( document.createTextNode(css) );
  return style;
  }

  function changeStyle( style, css ) {
  if( style.styleSheet )
  style.styleSheet.cssText = css;
  else
  style.replaceChild( document.createTextNode(css),
  style.firstChild );
  return style;
  }

  -Mike From: Andy Kent

   I'm working on fixing my JSS plugin for IE, it appears that
   IE has really problems with showing you the source of
   stylesheets that are between style tags.

   $('style').text() - returns null

   $('style').html() - returns the source but it is modified,
   e.g. all non-supported selectors are changed to 'UNKOWN'
   (very unhelpful!)

   Before I delve deeper into this does anyone have a work
   around already??

   I assume this is supposed to be some sort of security feature
   but it seems very strange seeing as loading external styles
   works as expected.

   Thanks,
   Andy.



[jQuery] Re: IE6 Stylesheet Woes

2007-10-09 Thread James Dempster
Hmm interestingly odd issue. Boo Boo to M$ IE

/James

On 10/9/07, Andy Kent [EMAIL PROTECTED] wrote:


 Thanks a heap for your help James, after lots of trial and error I
 managed to track down the source of the problem.

 It's a very curious IE issue, your examples work fine provided you
 don't try to access document.stylesheets first, if you do then that
 seems to kick IE off on a parsing spree.

 Oh well, all fixed now, thanks for your help.

 Andy.


 On 8 Oct, 17:03, James Dempster [EMAIL PROTECTED] wrote:
  Thats strange, I've added lots of strange chars and it still works ok
 for
  me.
 
  Screenshots
 .http://www.jdempster.com/public/jss/ie6.pnghttp://www.jdempster.com/public/jss/ie7.pnghttp://www.jdempster.com/public/jss/ff2.png
 
  I did test it in more but these will do for now. Can any one else check
  their IE?
 
  /James
 
  On 10/8/07, Andy Kent [EMAIL PROTECTED] wrote:
 
 
 
   This has the same issue I'm afraid.
 
   It works for all those examples as IE thinks they are valid. Give
   something like div~p:first a go though and I you get the selector
   replaced with the string 'UNKOWN' in the innerHTML source code.
 
   Thanks for the attempt but sill no prize yet!
 
   :( *tears*
 
   Andy.
 
   On 8 Oct, 14:43, James Dempster [EMAIL PROTECTED] wrote:
I've pinched some code from Christian Bach (
 http://lovepeacenukes.com/
jquery/ie6cssfix/) and put it into it's own test case. Tested it on
Win IE 6/7, FF 1.5/2, Safari3, Opera 9 and they all showed the same
results.
 
Test it out. Hopefully it can help
   .http://www.jdempster.com/public/jss/js_css.html
 
On Oct 8, 11:29 am, Andy Kent [EMAIL PROTECTED] wrote:
 
 Unfortunately after some experimentation this method still appears
 to
 yield 'UNKNOWN' in place of selectors that are not understood by
 IE.
 
 Poo.
 
 On 8 Oct, 11:15, Andy Kent [EMAIL PROTECTED] wrote:
 
  Thanks Mike, that's a huge help and sounds like it will solve my
  problem perfectly. I will have a play now.
 
  Should jQuery not be clever enough to handle this internally
 when
   you
  call .text() on a style element?
  Is it worth filing as a bug do you think?
 
  Andy.
 
  On 8 Oct, 11:07, Michael Geary [EMAIL PROTECTED] wrote:
 
   Andy, you can read or write the content of an IE stylesheet
 with:
 
  $('style')[n].styleSheet.cssText
 
   where n is the index of the stylesheet you want.
 
   Instead of browser detection, I test for the presence of that
   .styleSheet
   property, and then either use .styleSheet.cssText or .text()
   depending.
 
   Some example non-jQuery code that I use (shows writing and
   replacing but not
   reading):
 
   function addStyle( css ) {
   var style = document.createElement( 'style' );
   style.type = 'text/css';
   head.appendChild( style );
   if( style.styleSheet )
   style.styleSheet.cssText = css;
   else
   style.appendChild( document.createTextNode(css) );
   return style;
   }
 
   function changeStyle( style, css ) {
   if( style.styleSheet )
   style.styleSheet.cssText = css;
   else
   style.replaceChild( document.createTextNode(css),
   style.firstChild );
   return style;
   }
 
   -Mike From: Andy Kent
 
I'm working on fixing my JSS plugin for IE, it appears that
IE has really problems with showing you the source of
stylesheets that are between style tags.
 
$('style').text() - returns null
 
$('style').html() - returns the source but it is modified,
e.g. all non-supported selectors are changed to 'UNKOWN'
(very unhelpful!)
 
Before I delve deeper into this does anyone have a work
around already??
 
I assume this is supposed to be some sort of security
 feature
but it seems very strange seeing as loading external styles
works as expected.
 
Thanks,
Andy.


 



[jQuery] Re: IE6 Stylesheet Woes

2007-10-08 Thread Michael Geary

Andy, you can read or write the content of an IE stylesheet with:

   $('style')[n].styleSheet.cssText

where n is the index of the stylesheet you want.

Instead of browser detection, I test for the presence of that .styleSheet
property, and then either use .styleSheet.cssText or .text() depending.

Some example non-jQuery code that I use (shows writing and replacing but not
reading):

function addStyle( css ) {
var style = document.createElement( 'style' );
style.type = 'text/css';
head.appendChild( style );
if( style.styleSheet )
style.styleSheet.cssText = css;
else
style.appendChild( document.createTextNode(css) );
return style;
}

function changeStyle( style, css ) {
if( style.styleSheet )
style.styleSheet.cssText = css;
else
style.replaceChild( document.createTextNode(css),
style.firstChild );
return style;
}

-Mike

 From: Andy Kent
 
 I'm working on fixing my JSS plugin for IE, it appears that 
 IE has really problems with showing you the source of 
 stylesheets that are between style tags.
 
 $('style').text() - returns null
 
 $('style').html() - returns the source but it is modified, 
 e.g. all non-supported selectors are changed to 'UNKOWN' 
 (very unhelpful!)
 
 Before I delve deeper into this does anyone have a work 
 around already??
 
 I assume this is supposed to be some sort of security feature 
 but it seems very strange seeing as loading external styles 
 works as expected.
 
 Thanks,
 Andy.
 



[jQuery] Re: IE6 Stylesheet Woes

2007-10-08 Thread Andy Kent

Thanks Mike, that's a huge help and sounds like it will solve my
problem perfectly. I will have a play now.

Should jQuery not be clever enough to handle this internally when you
call .text() on a style element?
Is it worth filing as a bug do you think?

Andy.

On 8 Oct, 11:07, Michael Geary [EMAIL PROTECTED] wrote:
 Andy, you can read or write the content of an IE stylesheet with:

$('style')[n].styleSheet.cssText

 where n is the index of the stylesheet you want.

 Instead of browser detection, I test for the presence of that .styleSheet
 property, and then either use .styleSheet.cssText or .text() depending.

 Some example non-jQuery code that I use (shows writing and replacing but not
 reading):

 function addStyle( css ) {
 var style = document.createElement( 'style' );
 style.type = 'text/css';
 head.appendChild( style );
 if( style.styleSheet )
 style.styleSheet.cssText = css;
 else
 style.appendChild( document.createTextNode(css) );
 return style;
 }

 function changeStyle( style, css ) {
 if( style.styleSheet )
 style.styleSheet.cssText = css;
 else
 style.replaceChild( document.createTextNode(css),
 style.firstChild );
 return style;
 }

 -Mike From: Andy Kent

  I'm working on fixing my JSS plugin for IE, it appears that
  IE has really problems with showing you the source of
  stylesheets that are between style tags.

  $('style').text() - returns null

  $('style').html() - returns the source but it is modified,
  e.g. all non-supported selectors are changed to 'UNKOWN'
  (very unhelpful!)

  Before I delve deeper into this does anyone have a work
  around already??

  I assume this is supposed to be some sort of security feature
  but it seems very strange seeing as loading external styles
  works as expected.

  Thanks,
  Andy.



[jQuery] Re: IE6 Stylesheet Woes

2007-10-08 Thread Andy Kent

Unfortunately after some experimentation this method still appears to
yield 'UNKNOWN' in place of selectors that are not understood by IE.

Poo.

On 8 Oct, 11:15, Andy Kent [EMAIL PROTECTED] wrote:
 Thanks Mike, that's a huge help and sounds like it will solve my
 problem perfectly. I will have a play now.

 Should jQuery not be clever enough to handle this internally when you
 call .text() on a style element?
 Is it worth filing as a bug do you think?

 Andy.

 On 8 Oct, 11:07, Michael Geary [EMAIL PROTECTED] wrote:

  Andy, you can read or write the content of an IE stylesheet with:

 $('style')[n].styleSheet.cssText

  where n is the index of the stylesheet you want.

  Instead of browser detection, I test for the presence of that .styleSheet
  property, and then either use .styleSheet.cssText or .text() depending.

  Some example non-jQuery code that I use (shows writing and replacing but not
  reading):

  function addStyle( css ) {
  var style = document.createElement( 'style' );
  style.type = 'text/css';
  head.appendChild( style );
  if( style.styleSheet )
  style.styleSheet.cssText = css;
  else
  style.appendChild( document.createTextNode(css) );
  return style;
  }

  function changeStyle( style, css ) {
  if( style.styleSheet )
  style.styleSheet.cssText = css;
  else
  style.replaceChild( document.createTextNode(css),
  style.firstChild );
  return style;
  }

  -Mike From: Andy Kent

   I'm working on fixing my JSS plugin for IE, it appears that
   IE has really problems with showing you the source of
   stylesheets that are between style tags.

   $('style').text() - returns null

   $('style').html() - returns the source but it is modified,
   e.g. all non-supported selectors are changed to 'UNKOWN'
   (very unhelpful!)

   Before I delve deeper into this does anyone have a work
   around already??

   I assume this is supposed to be some sort of security feature
   but it seems very strange seeing as loading external styles
   works as expected.

   Thanks,
   Andy.



[jQuery] Re: IE6 Stylesheet Woes

2007-10-08 Thread James Dempster

I've pinched some code from Christian Bach (http://lovepeacenukes.com/
jquery/ie6cssfix/) and put it into it's own test case. Tested it on
Win IE 6/7, FF 1.5/2, Safari3, Opera 9 and they all showed the same
results.

Test it out. Hopefully it can help.
http://www.jdempster.com/public/jss/js_css.html

On Oct 8, 11:29 am, Andy Kent [EMAIL PROTECTED] wrote:
 Unfortunately after some experimentation this method still appears to
 yield 'UNKNOWN' in place of selectors that are not understood by IE.

 Poo.

 On 8 Oct, 11:15, Andy Kent [EMAIL PROTECTED] wrote:

  Thanks Mike, that's a huge help and sounds like it will solve my
  problem perfectly. I will have a play now.

  Should jQuery not be clever enough to handle this internally when you
  call .text() on a style element?
  Is it worth filing as a bug do you think?

  Andy.

  On 8 Oct, 11:07, Michael Geary [EMAIL PROTECTED] wrote:

   Andy, you can read or write the content of an IE stylesheet with:

  $('style')[n].styleSheet.cssText

   where n is the index of the stylesheet you want.

   Instead of browser detection, I test for the presence of that .styleSheet
   property, and then either use .styleSheet.cssText or .text() depending.

   Some example non-jQuery code that I use (shows writing and replacing but 
   not
   reading):

   function addStyle( css ) {
   var style = document.createElement( 'style' );
   style.type = 'text/css';
   head.appendChild( style );
   if( style.styleSheet )
   style.styleSheet.cssText = css;
   else
   style.appendChild( document.createTextNode(css) );
   return style;
   }

   function changeStyle( style, css ) {
   if( style.styleSheet )
   style.styleSheet.cssText = css;
   else
   style.replaceChild( document.createTextNode(css),
   style.firstChild );
   return style;
   }

   -Mike From: Andy Kent

I'm working on fixing my JSS plugin for IE, it appears that
IE has really problems with showing you the source of
stylesheets that are between style tags.

$('style').text() - returns null

$('style').html() - returns the source but it is modified,
e.g. all non-supported selectors are changed to 'UNKOWN'
(very unhelpful!)

Before I delve deeper into this does anyone have a work
around already??

I assume this is supposed to be some sort of security feature
but it seems very strange seeing as loading external styles
works as expected.

Thanks,
Andy.



[jQuery] Re: IE6 Stylesheet Woes

2007-10-08 Thread Andy Kent

This has the same issue I'm afraid.

It works for all those examples as IE thinks they are valid. Give
something like div~p:first a go though and I you get the selector
replaced with the string 'UNKOWN' in the innerHTML source code.

Thanks for the attempt but sill no prize yet!

:( *tears*

Andy.

On 8 Oct, 14:43, James Dempster [EMAIL PROTECTED] wrote:
 I've pinched some code from Christian Bach (http://lovepeacenukes.com/
 jquery/ie6cssfix/) and put it into it's own test case. Tested it on
 Win IE 6/7, FF 1.5/2, Safari3, Opera 9 and they all showed the same
 results.

 Test it out. Hopefully it can 
 help.http://www.jdempster.com/public/jss/js_css.html

 On Oct 8, 11:29 am, Andy Kent [EMAIL PROTECTED] wrote:

  Unfortunately after some experimentation this method still appears to
  yield 'UNKNOWN' in place of selectors that are not understood by IE.

  Poo.

  On 8 Oct, 11:15, Andy Kent [EMAIL PROTECTED] wrote:

   Thanks Mike, that's a huge help and sounds like it will solve my
   problem perfectly. I will have a play now.

   Should jQuery not be clever enough to handle this internally when you
   call .text() on a style element?
   Is it worth filing as a bug do you think?

   Andy.

   On 8 Oct, 11:07, Michael Geary [EMAIL PROTECTED] wrote:

Andy, you can read or write the content of an IE stylesheet with:

   $('style')[n].styleSheet.cssText

where n is the index of the stylesheet you want.

Instead of browser detection, I test for the presence of that 
.styleSheet
property, and then either use .styleSheet.cssText or .text() depending.

Some example non-jQuery code that I use (shows writing and replacing 
but not
reading):

function addStyle( css ) {
var style = document.createElement( 'style' );
style.type = 'text/css';
head.appendChild( style );
if( style.styleSheet )
style.styleSheet.cssText = css;
else
style.appendChild( document.createTextNode(css) );
return style;
}

function changeStyle( style, css ) {
if( style.styleSheet )
style.styleSheet.cssText = css;
else
style.replaceChild( document.createTextNode(css),
style.firstChild );
return style;
}

-Mike From: Andy Kent

 I'm working on fixing my JSS plugin for IE, it appears that
 IE has really problems with showing you the source of
 stylesheets that are between style tags.

 $('style').text() - returns null

 $('style').html() - returns the source but it is modified,
 e.g. all non-supported selectors are changed to 'UNKOWN'
 (very unhelpful!)

 Before I delve deeper into this does anyone have a work
 around already??

 I assume this is supposed to be some sort of security feature
 but it seems very strange seeing as loading external styles
 works as expected.

 Thanks,
 Andy.



[jQuery] Re: IE6 Stylesheet Woes

2007-10-08 Thread James Dempster
Thats strange, I've added lots of strange chars and it still works ok for
me.

Screenshots.
http://www.jdempster.com/public/jss/ie6.png
http://www.jdempster.com/public/jss/ie7.png
http://www.jdempster.com/public/jss/ff2.png

I did test it in more but these will do for now. Can any one else check
their IE?

/James

On 10/8/07, Andy Kent [EMAIL PROTECTED] wrote:


 This has the same issue I'm afraid.

 It works for all those examples as IE thinks they are valid. Give
 something like div~p:first a go though and I you get the selector
 replaced with the string 'UNKOWN' in the innerHTML source code.

 Thanks for the attempt but sill no prize yet!

 :( *tears*

 Andy.

 On 8 Oct, 14:43, James Dempster [EMAIL PROTECTED] wrote:
  I've pinched some code from Christian Bach (http://lovepeacenukes.com/
  jquery/ie6cssfix/) and put it into it's own test case. Tested it on
  Win IE 6/7, FF 1.5/2, Safari3, Opera 9 and they all showed the same
  results.
 
  Test it out. Hopefully it can help
 .http://www.jdempster.com/public/jss/js_css.html
 
  On Oct 8, 11:29 am, Andy Kent [EMAIL PROTECTED] wrote:
 
   Unfortunately after some experimentation this method still appears to
   yield 'UNKNOWN' in place of selectors that are not understood by IE.
 
   Poo.
 
   On 8 Oct, 11:15, Andy Kent [EMAIL PROTECTED] wrote:
 
Thanks Mike, that's a huge help and sounds like it will solve my
problem perfectly. I will have a play now.
 
Should jQuery not be clever enough to handle this internally when
 you
call .text() on a style element?
Is it worth filing as a bug do you think?
 
Andy.
 
On 8 Oct, 11:07, Michael Geary [EMAIL PROTECTED] wrote:
 
 Andy, you can read or write the content of an IE stylesheet with:
 
$('style')[n].styleSheet.cssText
 
 where n is the index of the stylesheet you want.
 
 Instead of browser detection, I test for the presence of that
 .styleSheet
 property, and then either use .styleSheet.cssText or .text()
 depending.
 
 Some example non-jQuery code that I use (shows writing and
 replacing but not
 reading):
 
 function addStyle( css ) {
 var style = document.createElement( 'style' );
 style.type = 'text/css';
 head.appendChild( style );
 if( style.styleSheet )
 style.styleSheet.cssText = css;
 else
 style.appendChild( document.createTextNode(css) );
 return style;
 }
 
 function changeStyle( style, css ) {
 if( style.styleSheet )
 style.styleSheet.cssText = css;
 else
 style.replaceChild( document.createTextNode(css),
 style.firstChild );
 return style;
 }
 
 -Mike From: Andy Kent
 
  I'm working on fixing my JSS plugin for IE, it appears that
  IE has really problems with showing you the source of
  stylesheets that are between style tags.
 
  $('style').text() - returns null
 
  $('style').html() - returns the source but it is modified,
  e.g. all non-supported selectors are changed to 'UNKOWN'
  (very unhelpful!)
 
  Before I delve deeper into this does anyone have a work
  around already??
 
  I assume this is supposed to be some sort of security feature
  but it seems very strange seeing as loading external styles
  works as expected.
 
  Thanks,
  Andy.