Comments (10)
Browser needs to check less css rules when adding elements to the dom.
from jss.
@kof But you lose the styles you detached? What am I missing? Do you reattach after adding elements?
from jss.
if you elements need your styles they need to be attached of course, don't understand the confusion.
from jss.
@kof I thought maybe there was something I was missing. It's like saying "Don't add any DOM elements to your page and it will perform better." :P
from jss.
Its about having styles for dom elements which use them. Not more not less. And yess less dom elements results in better performance.
from jss.
Ah I see the use case: when you have an html component, attach a stylesheet when the component has been added to the DOM, remove the associated stylesheet when the component is removed from the dom, so your styles morph in sync with your DOM structure. This is unlike the current approaches where all styles simply exist at all times regardless of what the DOM looks like. +1 I get it now. I think you're imagining something like that. :D
from jss.
This is interesting. See what type of problems the w3c spec has gotten us into? Cascading stylesheets seem to be a source of poor performance. At my job, in one of the older apps, the stylesheet is monolithic, with various routes of the app relying on overrides/cascades, and or just ignoring the existing classes and using all new ones for completely separate styles that exist in the same monolithic stylesheet.
And why does traditional HTML/CSS/JavaScript make it so difficult to make apps that feel "native"?
This why things like Famo.us and your awesome jss come into existence: to avoid the pitfalls of traditional HTML5/CSS/JavaScript. Instead of just creating components using traditional HTML from the get go, we are rethinking the whole way that things should work in the first place to get around the pitfalls of traditional HTML.
Thinking in more of a bigger picture, the actual redesign needs to happen in the underlying implementation of the browser, but that's a huge undertaking. I wish I could just snap my fingers and have QML-like performance in HTML. (try QML at least once if you haven't, it's free, and compare it to HTML. You might be amazed!)
from jss.
A little off topic, but maybe not in the grand scheme of things: A browser that would allow users to browse both QML-based and HTML-based sites might be revolutionary.
from jss.
Neither html nor css is designed for applications. I am pretty sure any of systems are better for this than what we use. However with right abstractions it can deliver good performance.
from jss.
I would be glad to see your findings about jss written down in a blogpost :)
from jss.
Related Issues (20)
- JSS Dynamic Rules are not removed on re-render V10.0.9
- export 'useInsertionEffect' (imported as 'useInsertionEffect') was not found in 'react' HOT 3
- Dynamic values don't work when using arrow functions HOT 7
- [cli] stdout is not a tty HOT 1
- get error msg in Micro-frontend environment: Cannot read properties of null (reading 'cssRules') HOT 3
- Support @container query HOT 9
- dynamic css issue under a certain condition since version 10.9.1-alpha.1 HOT 2
- Support @layer property HOT 2
- Re-rendering root node breaks dynamic styles HOT 10
- Docs are not able to load github's markdown files
- Bug with react-jss compilation: "Warning: [JSS] Rule is not linked. Missing sheet option "link: true"."
- TypeError: Cannot read properties of null (reading 'deleteRule')
- JSS for Preact
- React strict mode forces dynamic rules to be added twice which breaks hydration
- Code Execution Error after Applying Content Security Policy (CSP)
- Style block un-renders when any param used - since v10.0 HOT 1
- `react-jss` dynamic rules memory leak in strict mode
- StyleSheet.replaceRule does not replace media query rules
- How should i assign a counters() to the content property?
- Add specific id or data-tag to the style element injected in head?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jss.