GithubHelp home page GithubHelp logo

css-parser's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

css-parser's Issues

Comments Issues

Hi,

Awesome library!

I noticed whilst testing that it doesn't handle comments that are in the form:

/** My comment */

Notice the extra asterik.

Same for

/*********************/

Clone Property

Hi,

I have noticed an issue with merge function in the StyleRule class. This is one of the CSS properties that this function tries to deal with:

    CSS\Property Object
    (
        [name:CSS\Property:private] => background-color
        [valueList:CSS\Property:private] => CSS\PropertyValueList Object
            (
                [separator:protected] => ,
                [items:protected] => Array
                    (
                        [0] => CSS\Value\Color Object
                            (
                                [channels] => Array
                                    (
                                        [r] => 0
                                        [g] => 0
                                        [b] => 0
                                    )
                                [mode:CSS\Value\Color:private] => 
                            )
                    )
            )
        [isImportant:CSS\Property:private] => 
    )

However, it throws this error:

Fatal error: __clone method called on non-object in C:\PROJECT\svn\dev\vendor\julius\CSS\Value\Color.php on line 180

It seems to have an issue with Line 124:

           if ($override) {
                $aProperties[$name] = array(
                    'property' => clone $property,
                    'specificity' => $specificity
                );
            }

Can it clone the Color object?

Apologies if this is a basic question!

duplicate properties within a given selector

I noticed a small issue where if there are two css property declarations like so:

        #right_nav ul li a.current{
            padding:0px;
            padding:0 0 0 35px; 
         }

What will happen is that the returned expanded padding css property will all be 0 i.e:

   padding-left: 0; 
   padding-right: 0; 
   padding-top: 0; 
   padding-bottom 0;

So I investigated the _canAddShorthandExpansion function and it looks the condition on line: https://github.com/ju1ius/css-parser/blob/master/lib/ju1ius/Css/StyleDeclaration/ExpandShorthands.php#L271

Should be a < (less than). The smaller the number the further up the deceleration and the more important it is right?

Basically, what is happening is that the latter is not set as the final property. Another example would be:

margin: 10px 12 px 14px 16px;
margin: 30px;

The latter should be the final margin property. From my investigation, I could only narrow it down to that function and the greater than sign.

font-size and string values

I think when fonts are expanded into their long hand format the font-size values are only considered when they have units. Font size can be set using the strings such as "small", "large" etc. So on this line: https://github.com/ju1ius/css-parser/blob/master/lib/ju1ius/Css/StyleDeclaration/ExpandShorthands.php#L97

I made the crude change of this:

 } else if($mValue instanceof Value\Dimension && $mValue->getUnit() !== null 
 || in_array($mValue, array('xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', 'smaller', 'larger'))) {```

The above has managed to work for me so far.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.