From 98cad0f4103a68ac33c1e43112ca155ea259b14a Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Wed, 28 Aug 2013 16:20:47 -0700 Subject: [PATCH] Set contentEditable using jQuery#prop Also always use strings 'true'/'false' for the value, because it is a string property (spellcheck, however, is a boolean) and always use a capital second 'E' in the name. Change-Id: Ia4e1f9edfd8f236fe81df190e6a68729d7b52243 --- modules/ve-mw/ce/nodes/ve.ce.MWEntityNode.js | 2 +- modules/ve/ce/nodes/ve.ce.DocumentNode.js | 6 +++--- modules/ve/ce/ve.ce.ProtectedNode.js | 2 +- modules/ve/ce/ve.ce.Surface.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWEntityNode.js b/modules/ve-mw/ce/nodes/ve.ce.MWEntityNode.js index d17d560a79..9dfddb7be1 100644 --- a/modules/ve-mw/ce/nodes/ve.ce.MWEntityNode.js +++ b/modules/ve-mw/ce/nodes/ve.ce.MWEntityNode.js @@ -21,7 +21,7 @@ ve.ce.MWEntityNode = function VeCeMWEntityNode( model, config ) { // DOM changes this.$.addClass( 've-ce-mwEntityNode' ); // Need CE=false to prevent selection issues - this.$.attr( 'contenteditable', false ); + this.$.prop( 'contentEditable', 'false' ); // Events this.model.connect( this, { 'update': 'onUpdate' } ); diff --git a/modules/ve/ce/nodes/ve.ce.DocumentNode.js b/modules/ve/ce/nodes/ve.ce.DocumentNode.js index 3abb872bfd..c738d581ec 100644 --- a/modules/ve/ce/nodes/ve.ce.DocumentNode.js +++ b/modules/ve/ce/nodes/ve.ce.DocumentNode.js @@ -27,7 +27,7 @@ ve.ce.DocumentNode = function VeCeDocumentNode( model, surface, config ) { // DOM changes this.$.addClass( 've-ce-documentNode' ); - this.$.attr( { 'contentEditable': 'true', 'spellcheck': 'true' } ); + this.$.prop( { 'contentEditable': 'true', 'spellcheck': true } ); }; /* Inheritance */ @@ -68,7 +68,7 @@ ve.ce.DocumentNode.prototype.getSurface = function () { * @method */ ve.ce.DocumentNode.prototype.disable = function () { - this.$.attr( 'contentEditable', 'false' ); + this.$.prop( 'contentEditable', 'false' ); }; /** @@ -77,7 +77,7 @@ ve.ce.DocumentNode.prototype.disable = function () { * @method */ ve.ce.DocumentNode.prototype.enable = function () { - this.$.attr( 'contentEditable', 'true' ); + this.$.prop( 'contentEditable', 'true' ); }; /* Registration */ diff --git a/modules/ve/ce/ve.ce.ProtectedNode.js b/modules/ve/ce/ve.ce.ProtectedNode.js index dd995b1970..5fec0eda09 100644 --- a/modules/ve/ce/ve.ce.ProtectedNode.js +++ b/modules/ve/ce/ve.ce.ProtectedNode.js @@ -28,7 +28,7 @@ ve.ce.ProtectedNode = function VeCeProtectedNode() { // DOM changes this.$ .addClass( 've-ce-protectedNode' ) - .prop( 'contentEditable', false ); + .prop( 'contentEditable', 'false' ); }; /* Static Properties */ diff --git a/modules/ve/ce/ve.ce.Surface.js b/modules/ve/ce/ve.ce.Surface.js index 957eacbb2e..b9a0489aa2 100644 --- a/modules/ve/ce/ve.ce.Surface.js +++ b/modules/ve/ce/ve.ce.Surface.js @@ -82,7 +82,7 @@ ve.ce.Surface = function VeCeSurface( model, surface, options ) { this.$.addClass( 've-ce-surface' ); this.$phantoms.addClass( 've-ce-surface-phantoms' ); this.$highlights.addClass( 've-ce-surface-highlights' ); - this.$pasteTarget.addClass( 've-ce-surface-paste' ).prop( 'contenteditable', true ); + this.$pasteTarget.addClass( 've-ce-surface-paste' ).prop( 'contentEditable', 'true' ); // Add elements to the DOM this.$.append( this.documentView.getDocumentNode().$, this.$pasteTarget );