Comments (11)
innerHeight() - this.getDOMNode().clientHeight
css() - React classSet or Element classList or this.getDOMNode().style or this.getDOMNode().cssText
width() - this.getDOMNode().style.width
outerWidth() - this.getDOMNode().offsetWidth
height() - this.getDOMNode().style.height
parent() - Node.parentElement
addClass() / removeClass() - I would encourage using React's classSet, but Element.classList.add or remove can also be used
offset() - Element.getBoundingClientRect()
on() / off() - Element.addEventListener, but this can be handled by React's native events and probably shouldn't be necessary.
However, while these can be directly substituted, for many of them (like classes, events) React has its own pattern and way of doing things. This will require changing a little logic, but it will make everything run much smoother and allow for easier future development.
from material-ui.
from material-ui.
Isn't that just a docs specific dependency?
Does this mean that all of the source is implemented under the docs
folder? That's incredibly unintuitive.
from material-ui.
Look here var $el = $(this.getDOMNode()),
. You are right docs is the worst folder to put your src in. That's that I opened this issue
from material-ui.
👍
React and JQuery do not play nicely and ideally no React components should rely on JQuery.
from material-ui.
Here's what we're currently using out of the jQuery library:
Components:
- Dialog - innerHeight(), css()
- DropdownIcon - width(), css()
- DropdownMenu - width(), css()
- Menu - outterWidth(), width(), height(), css()
- Ripple - parent(), offset(), addClass(), removeClass(), css()
Mixins & Utils:
- ClickAwayable - on(), off()
- CssEvent - one()
Any suggestions on how we could remove the jQuery dependency and still have the above functionality?
from material-ui.
It would be nice to remove the jQuery dependency, since people are currently avoiding to use it because of the overheat in some projects.
from material-ui.
React and JQuery do not play nicely
@DUBERT care to elaborate on that, I'd like to know
from material-ui.
I've removed some of the jQuery dependencies. Still working on the others. Here's what's left:
- Menu - outterWidth(), width(), height(), children(), css()
- Ripple - parent(), offset(), addClass(), removeClass(), css()
Mixins & Utils:
- ClickAwayable - on(), off()
- CssEvent - one()
from material-ui.
There is one jQuery dependency that I can't get rid of. Currently, I'm using jQuery to namespace click events for the click-awayable mixin. This mixin allows components to do something if a click event happens outside of the component.
Anyone have a good way to do this with native JS? Here's the JS file I'm talking about:
https://github.com/callemall/material-ui/blob/master/src/js/mixins/click-awayable.js
from material-ui.
Figured it out. :)
from material-ui.
Related Issues (20)
- Add Repobeats (metrics) to README
- Type erros in `@mui/utils` HOT 1
- Module not found: Can't resolve '@emotion/react' in dual route (page,app) HOT 2
- [lab] Remove deprecated lab packages HOT 5
- [material-ui][Chip] Icon Not Centered When Only Icon is Provided HOT 4
- [material-ui][Select] Scroll inside select input HOT 4
- [material-ui] Move `CssVarsProvider` to `ThemeProvider` HOT 3
- [material-ui] Add Bento Grid component HOT 1
- [material-ui] Handling complex themes/palettes
- [docs] Routing Libraries List example contains deprecated `button` prop HOT 1
- Hydration error in next.js with MUI HOT 3
- getColorSchemeSelector returns the wrong selector when multiple are present HOT 1
- Label is not visible when using Select or Input components HOT 2
- @mui/material-nextjs@next does not work with @mui/[email protected]
- [material-ui][Autocomplete] Unexpected scrolling behaviour in virtualised custom Autocomplete component
- [material-ui][RadioGroup][FormControlLabel] onClick prop is called twice
- [material-ui][Autocomplete] Customize 'useAutocomplete' method based on the example provided
- Can'use Vietnamese keyboard in input field HOT 1
- MuiSvgIcon theme override doesn't work for width/height HOT 1
- [material-ui][Badge] When `showZero={false}` and value is `0` content is not updated HOT 1
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 material-ui.