Mooeypoo has uploaded a new change for review. https://gerrit.wikimedia.org/r/300170
Change subject: Allow 'data-*' attributes in personal tools links ...................................................................... Allow 'data-*' attributes in personal tools links We are limiting the attributes that are read and rendered for the personal toolbar, but there are cases -- especially as tools get more and more complex -- for needing to supply and read more information. The use case that led to this change is the need to style Notification badges with values in ::before and ::after pseudo-elements; these elements need to display some prefixed content, and the best (only) way to do that in no-js mode, is to set it up in CSS to be read out of an attribute (using attr( xxx ); ). This means that we need to read a specific attribute from the element, but the only attributes allowed were insufficient. Allowing for data-* attributes seemed not only a good solution for this specific case, but a good idea in general for future tools that are added and manipulate the personal toolbar links - allowing for storing information without polluting the DOM. Bug: T115845 Change-Id: Ic666540d70de52f337f839da0518cb83a990f5fd --- M includes/skins/BaseTemplate.php 1 file changed, 8 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/70/300170/1 diff --git a/includes/skins/BaseTemplate.php b/includes/skins/BaseTemplate.php index 13db176..84d4e30 100644 --- a/includes/skins/BaseTemplate.php +++ b/includes/skins/BaseTemplate.php @@ -140,7 +140,7 @@ if ( isset( $plink['active'] ) ) { $ptool['active'] = $plink['active']; } - foreach ( [ 'href', 'class', 'text', 'dir' ] as $k ) { + foreach ( [ 'href', 'class', 'text', 'dir', 'data' ] as $k ) { if ( isset( $plink[$k] ) ) { $ptool['links'][0][$k] = $plink[$k]; } @@ -363,6 +363,13 @@ unset( $attrs[$k] ); } + if ( isset( $attrs['data'] ) ) { + foreach ( $attrs['data'] as $key => $value ) { + $attrs[ 'data-' . $key ] = $value; + unset( $attrs[ 'data' ] ); + } + } + if ( isset( $item['id'] ) && !isset( $item['single-id'] ) ) { $item['single-id'] = $item['id']; } -- To view, visit https://gerrit.wikimedia.org/r/300170 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic666540d70de52f337f839da0518cb83a990f5fd Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Mooeypoo <mor...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits