From 2286259681907a06624916ccdd5b629af56fafca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Inez=20Korczyn=CC=81ski?= Date: Thu, 25 Apr 2013 14:41:21 -0700 Subject: [PATCH] New static property - renderHtmlAttributes It is going to be used at least for figure tags for which Parsoid gives as a lot of CSS class names that are useless for rendering purpose Change-Id: I4b1e8084a6b7ab5294e0c3cf153fc6cffb3e8dac --- modules/ve/ce/ve.ce.View.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/modules/ve/ce/ve.ce.View.js b/modules/ve/ce/ve.ce.View.js index cb9ae7e871..188ac6d567 100644 --- a/modules/ve/ce/ve.ce.View.js +++ b/modules/ve/ce/ve.ce.View.js @@ -26,11 +26,13 @@ ve.ce.View = function VeCeView( model, $element ) { // Initialization this.$.data( 'view', this ); - ve.setDomAttributes( - this.$[0], - this.model.getAttributes( 'html/0/' ), - this.constructor.static.domAttributeWhitelist - ); + if ( this.constructor.static.renderHtmlAttributes ) { + ve.setDomAttributes( + this.$[0], + this.model.getAttributes( 'html/0/' ), + this.constructor.static.domAttributeWhitelist + ); + } }; /* Inheritance */ @@ -71,6 +73,16 @@ ve.ce.View.static.domAttributeWhitelist = [ 'summary', 'title', 'type', 'typeof', 'valign', 'value', 'width' ]; +/** + * Whether or not HTML attributes listed in domAttributeWhitelist and present in HTMLDOM should be + * added to node anchor (this.$). + * + * @static + * @property static.renderHtmlAttributes + * @inheritable + */ +ve.ce.View.static.renderHtmlAttributes = true; + /* Methods */ /**