mediawiki-extensions-Math/modules/ve-math/ve.ce.MWMathNode.js
Thalia d81a1ff7ad Fix the check for the error class in generated content
Check the root of the generated content for the 'error'
class as well as the children.

Change-Id: I29044b5bfc33ce250c415a54d6c56f0620680658
2015-10-01 21:09:50 +01:00

58 lines
1.2 KiB
JavaScript

/*!
* VisualEditor ContentEditable MWMathNode class.
*
* @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/*global ve, OO */
/**
* ContentEditable MediaWiki math node.
*
* @class
* @extends ve.ce.MWInlineExtensionNode
*
* @constructor
* @param {ve.dm.MWMathNode} model Model to observe
* @param {Object} [config] Configuration options
*/
ve.ce.MWMathNode = function VeCeMWMathNode() {
// Parent constructor
ve.ce.MWMathNode.super.apply( this, arguments );
};
/* Inheritance */
OO.inheritClass( ve.ce.MWMathNode, ve.ce.MWInlineExtensionNode );
/* Static Properties */
ve.ce.MWMathNode.static.name = 'mwMath';
ve.ce.MWMathNode.static.primaryCommandName = 'math';
/* Methods */
/**
* @inheritdoc
*/
ve.ce.MWMathNode.prototype.onSetup = function () {
// Parent method
ve.ce.MWMathNode.super.prototype.onSetup.call( this );
// DOM changes
this.$element.addClass( 've-ce-mwMathNode' );
};
/**
* @inheritdoc ve.ce.GeneratedContentNode
*/
ve.ce.MWMathNode.prototype.validateGeneratedContents = function ( $element ) {
return !( $element.find( '.error' ).addBack( '.error' ).length );
};
/* Registration */
ve.ce.nodeFactory.register( ve.ce.MWMathNode );