Skip to content

Conversation

lucaswerkmeister
Copy link
Member

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.)

@lucaswerkmeister
Copy link
Member Author

I’m not sure which Phabricator task this should be attached to – T396863 (extract some sub-components), T396445 (SSR sub-components), or maybe a new one?

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.)
Copy link
Contributor

@yerdua yerdua left a 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!

@yerdua yerdua merged commit ce95664 into master Jun 17, 2025
8 checks passed
@yerdua yerdua deleted the kebab-case branch June 17, 2025 12:23
@lucaswerkmeister
Copy link
Member Author

I’m not sure which Phabricator task this should be attached to – T396863 (extract some sub-components), T396445 (SSR sub-components), or maybe a new one?

I filed T397220 for it now.

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
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants