-
Notifications
You must be signed in to change notification settings - Fork 7
Handle kebab-case attributes in component calls #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mariushoch
reviewed
Jun 17, 2025
libxml2 throws away the capitalization of attribute names (we always see them all-lowercase), so component props must be specified in kebab-case (e.g. :property-url= rather than :propertyUrl=); for this to work, php-vuejs-templating needs to map the prop name back to camelCase somewhere. Do this in handleComponent(). (Alternatively, it could probably happen in App::renderComponentToDOM() or Component::render(), but that would suggest that PHP entry points can provide props in either format, and that feels bad to me.)
11aeb5b
to
67d182b
Compare
yerdua
approved these changes
Jun 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me!
wmfgerrit
pushed a commit
to wikimedia/mediawiki-extensions
that referenced
this pull request
Jun 23, 2025
* Update Wikibase from branch 'master' to 07521b319a3d0f5b3c7631bc08d75255e6d86d3f - Merge "Extract first subcomponent for mobile editing experience" - Extract first subcomponent for mobile editing experience Using the new App class in the upcoming php-vuejs-templating 2.2.0 (currently -beta.2, will need more polishing before a stable release). Note that the props for the property name component currently must be called url and label, not propertyUrl and propertyLabel. This is because attribute names are lowercased during HTML parsing in PHP, so we must specify them using kebab-case (:property-url=, not :propertyUrl=); but php-vuejs-templating doesn’t currently undo the kebab case conversion (so inside the subcomponent, {{ propertyUrl }} would be missing because it only sees a property-url variable). A future php-vuejs-templating version will fix this [1], at which point we could rename the attributes if we wanted to. [1]: wmde/php-vuejs-templating#37 Bug: T396863 Change-Id: I2fae398f716a9a0cdef390f4e89e2d5fbf908e3d Depends-On: I5f2fd83f73b78d8c91c7831af9bead4f7635eb5e
wmfgerrit
pushed a commit
to wikimedia/mediawiki-extensions-Wikibase
that referenced
this pull request
Jun 23, 2025
Using the new App class in the upcoming php-vuejs-templating 2.2.0 (currently -beta.2, will need more polishing before a stable release). Note that the props for the property name component currently must be called url and label, not propertyUrl and propertyLabel. This is because attribute names are lowercased during HTML parsing in PHP, so we must specify them using kebab-case (:property-url=, not :propertyUrl=); but php-vuejs-templating doesn’t currently undo the kebab case conversion (so inside the subcomponent, {{ propertyUrl }} would be missing because it only sees a property-url variable). A future php-vuejs-templating version will fix this [1], at which point we could rename the attributes if we wanted to. [1]: wmde/php-vuejs-templating#37 Bug: T396863 Change-Id: I2fae398f716a9a0cdef390f4e89e2d5fbf908e3d Depends-On: I5f2fd83f73b78d8c91c7831af9bead4f7635eb5e
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
libxml2 throws away the capitalization of attribute names (we always see them all-lowercase), so component props must be specified in kebab-case (e.g.
:property-url=
rather than:propertyUrl=
); for this to work, php-vuejs-templating needs to map the prop name back to camelCase somewhere. Do this inhandleComponent()
. (Alternatively, it could probably happen inApp::renderComponentToDOM()
orComponent::render()
, but that would suggest that PHP entry points can provide props in either format, and that feels bad to me.)