• Resolved globaltimoto

    (@globaltimoto)


    Great works very well !

    The only issue I have is with the minor w3c validation error I get due to this bit of code adding space at the beginning of a property:

    $args['container_class'].= ' responsiveSelectContainer';
    $args['menu_class'].= ' responsiveSelectFullMenu';

    The resulting browser source looks like this:

    <div class=" responsiveSelectContainer">

    notice the space at the beginning of the property.

    W001: There should not be any white space at the start or end of an attribute’s value. This is a minor issue and can probably be ignored. See http://www.w3.org/TR/html4/types.html#type-id

    It’s such a minor error that the w3c HTML5 validator doesn’t raise the error or even warning, but perhaps it will in the future.

    I tried removing the whitespace in the plugin, but that broke the plugin functionality.

    Is there a minor fix I could try ?

    http://wordpress.org/plugins/responsive-select-menu/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author sevenspark

    (@sevenspark)

    You’d have to do some testing in the code and determine if the string is empty – then don’t add a space, if the string is not empty, then add one. Like you said, this is really not anything to worry about.

    My guess is that if you added classes to the main wp_nav_menu call in the theme for these parameters, it’d also solve that.

    Best,

    Chris

    Thread Starter globaltimoto

    (@globaltimoto)

    Not sure I understand what to do there.

    Is there a reason why the plugin needs to add the leading whitespace in the first place ?

    Plugin Author sevenspark

    (@sevenspark)

    Because normally there is another class already in the class string, and adding to the string without a space will break everything.

    With most themes, this happens, because they pass a class to wp_nav_menu

    //class is already set by theme
    $class = 'menu';
    
    //RSM adds a new class it can reference, with a leading space to build the class string properly
    $class.= ' responsiveSelectContainer';
    
    //the result is this:
    <nav class="menu responsiveSelectContainer">

    In your case, you don’t have a class set in wp_nav_menu

    //No class is set
    $class = '';
    
    //RSM adds class
    $class.= ' responsiveSelectContainer';
    
    //result has leading whitespace
    <nav class=" responsiveSelectContainer">

    But if we remove the leading white space, in the first example you get this

    <nav class="menuresponsiveSelectContainer">

    which will break everything.

    Like I said, we could test for an empty string before adding whitespace. I’ll consider that for the next release. But like we both said above… it is incredibly insignificant and truly not worth worrying about 😉

    Thread Starter globaltimoto

    (@globaltimoto)

    Thank you for the detailed explanation and for considering my insignificance. 🙂

    Plugin Author sevenspark

    (@sevenspark)

    haha you’re welcome, obviously didn’t mean to imply you or your concerns are insignificant, just the whitespace itself is insignificant 😛

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘w3c minor error whitespace at start of property’ is closed to new replies.