1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed Style property: unit handling error

Discussion in 'Resolved Bug Reports' started by Arty, Oct 12, 2012.

  1. Arty

    Arty Well-Known Member

    When editing style properties via WebDav, if background position value is 0 and it has units, XenForo considers whole background statement invalid.

    Example

    This line is parsed correctly:
    Code:
    background: transparent url('@imagePath/xenforo/xenforo-ui-sprite.png') no-repeat -64px 0;
    But when using this line:
    Code:
    background: transparent url('@imagePath/xenforo/xenforo-ui-sprite.png') no-repeat -64px 0px;
    XenForo considers it invalid and adds -xenforo-nomatch- prefix.

    Bigger chunk of test code:

    Save the following data via WebDav:
    Code:
            @property "arrowWidget";
            background: transparent url('@imagePath/xenforo/xenforo-ui-sprite.png') no-repeat -64px 0px;
            width: 14px;
            @property "/arrowWidget";
    
    then reload css template. That code will look like this:
    Code:
            @property "arrowWidget";
            width: 14px;
            @property "/arrowWidget";
        -xenforo-nomatch-background: transparent url('@imagePath/xenforo/xenforo-ui-sprite.png') no-repeat -64px 0px;
    
     
    Adam Howard, Jake Bunce and Shelley like this.
  2. Ralf

    Ralf Member

    ok, thanks:D
    very confusing, i had to play many hours around that problem
    to figure out that css line will be automaticly replaced with xenforo-nomatch
     
  3. Luxus

    Luxus Well-Known Member

    This stupid xenforo nomatch bug has messed up my style now :(
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Confirmed.

    Code fix to add optional units to the 0 value:

    library/XenForo/Model/StyleProperty.php

    Add the red code:

    Code:
    			else if (preg_match('/^(
    					(
    						(left|center|right|0(%|[a-z]+)?|-?\d+(\.\d+)?(%|[a-z]+))
    						(
    							\s+(top|center|bottom|0(%|[a-z]+)?|-?\d+(\.\d+)?(%|[a-z]+))
    						)?
    					)|top|center|bottom
    				)/ix', $value, $match))
    			{
    				if (isset($output['background-position']))
    				{
    					return false;
    				}
    				$output['background-position'] = $match[0];
    			}
    
     
    Luxus likes this.
  5. Mike

    Mike XenForo Developer Staff Member

    There were a couple other rule regexes that could trigger this, so I've sorted them now too.
     
    Slavik likes this.

Share This Page