class=" xxx "

Post here if your topic is about CSE HTML Validator but doesn't fit in another forum.

class=" xxx "

Postby roedygr » Sat May 04, 2013 3:11 pm

I discovered "errors" in my markup of the form class=" xxx ". lead/and/or/trailing spaces on class parms.

There were screwing up my global search/replaces.

Are these kosher? HTML Validator does not complain or warn about them.

IIRC I can configure whether I like spaces around the =.
User avatar
roedygr
Rank V - Professional
Rank V - Professional
 
Posts: 249
Joined: Fri Feb 17, 2006 6:22 am
Location: Victoria BC Canada

Re: class=" xxx "

Postby Albert Wiersch » Mon May 06, 2013 9:16 am

Hello Roedy,

Here is more information on the "class" attribute:
http://www.w3.org/html/wg/drafts/html/m ... ml#classes

And the parsing information:
http://www.w3.org/html/wg/drafts/html/m ... -on-spaces

So it should not be a problem. Preceding and trailing spaces should be kosher.

However, it should be possible to write a small "user function" to generate a message if there are leading or trailing white-space characters. I've done this below.

Code: Select all
function onAttributeID_124() { // "_124" because 124 is the ID of the "class" attribute
 if checkString(3,CurrentAttValue) {
  Message(1,MSG_WARNING,'The value for "'+CurrentAttName+'" has has leading and/or trailing white-space characters.',getAttValueLocation(CurrentAttIndex));
 }
}


Just put all your user functions in a *.cfg text file and specify that filename in the Validator Engine Options, Validator Engine->Config File page. You'll need to reload the configuration for any changes in the file to take effect.
Image
Albert Wiersch
User avatar
Albert Wiersch
Site Admin
Site Admin
 
Posts: 2433
Joined: Sat Dec 11, 2004 10:23 am
Location: Near Dallas, TX


Return to Other CSE HTML Validator

Who is online

Users browsing this forum: No registered users and 0 guests

cron