diff --git a/src/common/core/core.js b/src/common/core/core.js index 80d87f478..24e097d2f 100644 --- a/src/common/core/core.js +++ b/src/common/core/core.js @@ -2519,6 +2519,10 @@ define([ ensureType(name, 'name', 'string'); ensureValue(value, 'value'); + if (core.getValidAttributeNames(node).indexOf(name) === -1) { + throw new CoreIllegalOperationError('Not a valid attribute name [' + name + '] of the node.'); + } + return core.isValidAttributeValueOf(node, name, value); }; @@ -4113,7 +4117,7 @@ define([ ensureNode(node, 'node'); ensureType(name, 'name', 'string'); - if ((core.getValidAttributeNames(node) || []).indexOf(name) === -1) { + if (core.getValidAttributeNames(node).indexOf(name) === -1) { throw new CoreIllegalOperationError('Not a valid attribute name [' + name + '] of the node.'); } diff --git a/test/common/core/core.spec.js b/test/common/core/core.spec.js index cafd45169..907dbc124 100644 --- a/test/common/core/core.spec.js +++ b/test/common/core/core.spec.js @@ -2889,7 +2889,16 @@ describe('core', function () { } try { - core.isValidAttributeValueOf(rootNode, 'attr', undefined); + core.isValidAttributeValueOf(rootNode, 'name', undefined); + } catch (e) { + myError = e; + } finally { + expect(myError.name).to.eql('CoreIllegalArgumentError'); + myError = null; + } + + try { + core.isValidAttributeValueOf(rootNode, 'nonexisting', undefined); } catch (e) { myError = e; } finally {