GithubHelp home page GithubHelp logo

Comments (8)

kof avatar kof commented on April 27, 2024

Give me a use case in jss ....

from jss.

kof avatar kof commented on April 27, 2024

+= is just string concatenation in your case, it can be done already ...

from jss.

trusktr avatar trusktr commented on April 27, 2024

@kof += on el.style won't actually modify the string if the appended string would override a previous part of the property or is invalid for that property. f.e., if you do

el.style.background = "url(one.png)";
el.style.background += " url(two.png)";
console.log(el.style.background); // logs "url(one.png)"

but if you do

el.style.background = "url(one.png)";
el.style.background += " fixed";
console.log(el.style.background); // logs "url(one.png) fixed"

Basically it only modifies the string if the result is valid and makes sense. There can only be a single url() in the background property, so when you try to add a second one, it ignores the new value and leaves it at the old value. f.e.

el.style.background = "red";
el.style.background = "urrl(one.png)"; // urrl is invalid, leaves the previous value intact.
console.log(el.style.background); // logs "red"

from jss.

kof avatar kof commented on April 27, 2024

yes it ignores strings if the resulted rule will be invalid.

from jss.

kof avatar kof commented on April 27, 2024

I still don't see a concrete use case ...

from jss.

trusktr avatar trusktr commented on April 27, 2024

Yeah, it's more practical to just modify non-shorthand properties, e.g. background-image, -position, etc, and code is more readable that way.

from jss.

trusktr avatar trusktr commented on April 27, 2024

Something more useful would be a method like rule.unShorthand that splits shorthand properties into the longhand properties.

from jss.

kof avatar kof commented on April 27, 2024

I don't see any value, just overhead.

from jss.

Related Issues (20)

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.