Comments (10)
Good catch, we probably need to special-case line-height
. May need some special case here: https://github.com/reactjs/react-magic/blob/master/src/htmltojsx.js#L127-L129
from react-magic.
Should determine where React pulls this blacklist from: http://facebook.github.io/react/tips/style-props-value-px.html
from react-magic.
@Daniel15 Why modify those values at all? React 16 will stop appending 'px' for CSS values, so that modification will potentially break. Can HTMLtoJSX simply use the values verbatim?
from react-magic.
https://facebook.github.io/react/blog/2016/04/07/react-v15.html#new-helpful-warnings
React DOM: When specifying a unit-less CSS value as a string, a future version will not add px automatically.
from react-magic.
@ssorallen - That changelog entry only applies to strings (eg. {{width: '123'}}
, not numbers (eg. {{width: 123}}
). The behaviour for numbers remains unchanged.
Having said that, there's no harm in keeping the px
suffix, so maybe HTMLtoJSX should just use it verbatim.
from react-magic.
any news about this issue?
from react-magic.
@mrdShinse I don't think anyone has submitted a PR to fix it yet
from react-magic.
@ssorallen - That changelog entry only applies to strings (eg.
{{width: '123'}}
, not numbers (eg.{{width: 123}}
). The behaviour for numbers remains unchanged.Having said that, there's no harm in keeping the
px
suffix, so maybe HTMLtoJSX should just use it verbatim.
If this is the case, this can be solved simply by removing these lines https://github.com/reactjs/react-magic/blob/master/src/htmltojsx.js#L727-L729 along with the isConvertiblePixelValue
function. Please advise if I'm missing some reason some styles need the px
suffix omitted.
from react-magic.
ESLint rule so this behavior can be prevented.
{
...
"rules": {
"no-restricted-syntax": [
"error",
{
"selector": "Property[key.name=lineHeight] > Literal[value=/([0-9]+)[^px]$/]",
"message": "Make sure to specify an unit when using lineHeight (see React issue: https://github.com/reactjs/react-magic/issues/53)"
}
]
}
}
from react-magic.
I'm willing to make a PR if someone can tell me where I can add an exception for line-height
.
EDIT: I see that you have this method to strip px
values but I can't where is being used:
Line 259 in b915f5a
from react-magic.
Related Issues (20)
- Ability to preload links on hover, or expose enough of an API for users to implement. HOT 1
- Comparison to TurboLinks
- Getting hit with wall of errors HOT 3
- Convert hyphenated attributes into camelCase HOT 1
- [HtmlToJsx] View logic? F.e., how do we loop through items in an HTML view? HOT 2
- onclick attribute not getting renamed to onClick HOT 1
- Feature Request : Make this work in a web worker HOT 1
- HTMLtoJSX page is broken HOT 3
- HTML to JSX is broken HOT 5
- Autofocus isn't camel-cased HOT 2
- Change React.createClass to ES class
- feature request: serialize nodes and attributes to custom code
- HTMLtoJSX, better document default behavior
- SVG: incorrect gradientunits attribute
- complex style prop not parsed correctly
- White-space conversion on text nodes or inline elements HOT 2
- react 16 HOT 1
- Reactmagic site have "<" unexcpected error
- Add option to output Functional component (as well as import and export statement)
- ref value in react
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 react-magic.