Thanks Frank but the technique will not work with CSS definitions.
The JavaScript itself isn't a necessity and doesn't require <noscript> apart 
from applying noJS.css

If the backgrounds are stated in a "loaded" css then it is fetched regardless 
of even a display none property.
That is:

                .imgRef {background:url(...)}
                .hasJS .imgRef {display:none}

Or:
                .imgRef {display:none; background:url(...);}

Or:
                .non-existent-class {display:none; background:url(...)}

Does not prevent IE loading the background-image.

So maybe a better question would be:
How do you prevent any browsers loading a background graphic stated in CSS?
That would remove the need for the noJS.css file completely.


Mike Foskett
http://webSemantics.co.uk/<http://websemantics.co.uk/>


From: [email protected] [mailto:[email protected]] On 
Behalf Of Frank M. Palinkas
Sent: 14 July 2011 13:41
To: [email protected]
Subject: Re: [WSG] Breaking validation using noscript - Is there a solution?

Hi Mike,

Don't know if this will help, but I wrote an article last year on replacing the 
<noscript> element with Dom/JavaScript.

http://dev.opera.com/articles/view/replacing-noscript-with-accessible-un/

Med vennlig hilsen / Kind regards,
Frank M. Palinkas
Senior Technical Writer, Web Standards and Accessibility Designer
Core Engineering, Opera Software ASA, Oslo, Norway
Mobile: (+47) 95 17 61 11
Web standards and accessibility tutorials: http://dev.opera.com/author/947856


On Thu, Jul 14, 2011 at 12:36 PM, Foskett, Mike 
<[email protected]<mailto:[email protected]>> wrote:

Hi all,

Just finished a major update for Tesco's homepage.

                http://www.tesco.com/

Tesco's are the UKs largest retailer and this page gets approximately 1 million 
hits a day.

The page has been speed tweaked as much as possible given IT / server 
restraints.
Unfortunately the page now fails W3C formal grammar validation.

Because the page as designed was a massive 1.4MB (previously 260 Kb - 330 Kb), 
JavaScript was used to fetch image upon demand rather than on-load or post-load.
This greatly reduced the impact on the servers (critical) and improved the 
initial page load speed.

Obviously a no JavaScript version was also required.

The image references cannot be in the standard CSS as IE loaded all the images, 
used or not:

                .noJS .imgRef {background:url(...)}

Will not work.

All the image references were placed into a separate CSS noJS.css and the link 
in a <noscript> and this is where the validation breaks.
Apparently <noscript> is illegal in the <head>, and a <noscript> containing a 
<link> is illegal in the body.

                <noscript>
                                <link rel="stylesheet" 
href="/homepages/default/noJS.compressed.css" type="text/css" media="all" />
                </noscript>

I went for placing it in the body so the noscript is legal but the link 
reference is not.

I can see no alternative, and wondered if any of the list members had a more 
valid solution?


Regards,

Mike Foskett
http://webSemantics.co.uk/<http://websemantics.co.uk/>

________________________________
This is a confidential email. Tesco may monitor and record all emails. The 
views expressed in this email are those of the sender and not Tesco.

Tesco Stores Limited
Company Number: 519500
Registered in England
Registered Office: Tesco House, Delamare Road, Cheshunt, Hertfordshire EN8 9SL
VAT Registration Number: GB 220 4302 31

*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [email protected]<mailto:[email protected]>
*******************************************************************


*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [email protected]
*******************************************************************



*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [email protected]
*******************************************************************

Reply via email to