r107540 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107539‎ | r107540 | r107541 >
Date:22:47, 28 December 2011
Author:rmoen
Status:ok
Tags:
Comment:
Rollback to reading item data in class name to prevent parser from removing html5 attributes, follow up to r107529
Modified paths:
  • /trunk/extensions/MarkAsHelpful/modules/ext.markAsHelpful/ext.markAsHelpful.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MarkAsHelpful/modules/ext.markAsHelpful/ext.markAsHelpful.js
@@ -8,7 +8,7 @@
99
1010 var mah = mw.mah = {
1111 loadedItems: [],
12 - selector: '.markashelpful-item', //class of element(s) to apply MarkAsHelpful to.
 12+ selector: '[class^=markashelpful]', //class of element(s) to apply MarkAsHelpful to.
1313
1414 init: function() {
1515 var props, thisItem;
@@ -28,10 +28,13 @@
2929 * Return object of item properties
3030 */
3131 getItemProperties: function( $item ) {
32 - var properties = {
33 - 'item': $item.data('markashelpful-item'), // item id
34 - 'type': $item.data('markashelpful-type') // item type (eg, mbresponse)
35 - };
 32+ var tag = $item.attr( 'class' ),
 33+ //item properties are stored in classname to prevent parser from stripping out non html 5 objects.
 34+ //(eg data-markashelpful-item)
 35+ properties = {
 36+ 'item': tag.split( '-' )[2], // item id
 37+ 'type': tag.split( '-' )[1] // item type (eg, mbresponse)
 38+ };
3639 return properties;
3740 },
3841

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r107529follow up to r107527 to pretty up the response elements a bitrmoen21:12, 28 December 2011

Status & tagging log