Comments (4)
The runtime should actually already be fine with this - it needs xhp library and typechecker extensions though.
From an open source perspective, this would probably need to be a new language feature rather than a .hhconfig
option - we definitely don't want to encourage libraries that require .hhconfig
changes (or any other project-wide or global setting), but it's workable in a monorepo
from xhp-lib.
it needs xhp library and typechecker extensions though
Assuming this change would need to be in the HHVM repo, then? e.g. here?
If you have some pointers, I'd be happy to try and contribute to this if I have time. I doubt it's urgent since I'm guessing no one has asked for this before me haha.
Main thing that's still unclear to me is how to actually configure which special attribute prefixes to allow. I'm assuming the "would probably need to be a new language feature" means rather than a config option it'd be some new special syntax for how to declare these (e.g. in addition to attribute
something like special-attributes
but with an actually-good name). Would still be nice though to have some way to extend/augment the existing XHP HTML elements with these special attributes. Unless the intention is to require reimplementing core elements whenever non-standard attributes are desired. While I'd understand that principle... it'd be a bit annoying haha.
But yeah. As said above, if you have some idea of how this would get done, I'd be down to give it a shot.
from xhp-lib.
I am very interested in how this would be implemented. I am worried this will make xhp attributes more unsound. data-
and aria-
are unsound. If the information about which prefixes are special depends on the (base)type, you are left reimplementing the html tags anyway. If this information is dynamically configurable, this would make any attribute string prefix-thing
possibly unsound.
Would it be okay if the renderer could be configured to special case prefixes like data-up-
to render as up-
? So in XHP, you'd write.
<p data-up-expand="JS" />
which would render as <p up-expand="JS"></p>
?
Lines 163 to 181 in d6893af
Adding an if () {}
here would keep type safety equal, at the cost of having to type out data- prefixes.
from xhp-lib.
I think we'd be very unlikely to provide a way to retrofit this to existing HTML classes:
- it is essentially what the
data-
attributes are meant for - it would make migrating XHP attributes to be class properties much more difficult - we would already have to special-case data- and aria-, but these can be detected just at the callsite. Allowing plugin-extensions here would require looking at parts of the current tree that are not ancestors in the class hierarchy
from xhp-lib.
Related Issues (20)
- Remove XHPRoot, seal `x:node`/composable-element to x:primitive and x:element HOT 5
- [ Todo ] When XHP version 4 is released, update the docs about runtime validation in user-documentation. HOT 2
- Remove class2element/element2class
- Audit all code that is not in namespaces HOT 1
- Do we want the HTML xhp classes to be final in v4?
- [ RFC ] Introduce a new exception class for modifying/rendering xhp after initial render HOT 1
- Remove string selectors from getFirstChild and friends
- Audit missing category declarations HOT 4
- Rewrite docs on user-documentation to use xhp 4 syntax and rules HOT 2
- Make a full list of changes from v3
- Write a migration guide for v3 -> v4
- better exception message when rendering parent with an already rendered child HOT 8
- Review and consider removing all 'deprecated' features HOT 1
- Update README to reflect xhp-4
- hhvm 4.97 issue: x\node should permit ?XHPChild children HOT 2
- Class Undefined xhp-lib v3 HOT 9
- Use of XHP at Facebook HOT 2
- Default values of aria- and data- attributes are ignored
- Status of the project HOT 3
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 xhp-lib.