Skip to content

Commit

Permalink
Addition to #6046, renamed isHTMLElement to more appropiate naming is…
Browse files Browse the repository at this point in the history
…DOMElement.
  • Loading branch information
jon-a-nygaard committed Apr 24, 2017
1 parent 5814242 commit af467f2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions js/parts/Utilities.js
Expand Up @@ -449,7 +449,7 @@ H.merge = function () {
if (
H.isObject(value, true) &&
!H.isClass(value) &&
!H.isHTMLElement(value)
!H.isDOMElement(value)
) {
copy[key] = doCopy(copy[key] || {}, value);

Expand Down Expand Up @@ -530,12 +530,12 @@ H.isObject = function (obj, strict) {
/**
* Utility function to check if an Object is a HTML Element.
*
* @function #isHTMLElement
* @function #isDOMElement
* @memberOf Highcharts
* @param {Object} obj - The item to check.
* @returns {Boolean} - True if the argument is a HTML Element.
*/
H.isHTMLElement = function (obj) {
H.isDOMElement = function (obj) {
return H.isObject(obj) && typeof obj.nodeType === 'number';
};

Expand All @@ -551,7 +551,7 @@ H.isClass = function (obj) {
var c = obj && obj.constructor;
return !!(
H.isObject(obj, true) &&
!H.isHTMLElement(obj) &&
!H.isDOMElement(obj) &&
(c && c.name && c.name !== 'Object')
);
};
Expand Down
24 changes: 12 additions & 12 deletions samples/unit-tests/utilities/utilities/demo.js
Expand Up @@ -364,60 +364,60 @@ QUnit.test('DateFormat', function (assert) {
});


QUnit.test('isHTMLElement', function (assert) {
var isHTMLElement = Highcharts.isHTMLElement,
QUnit.test('isDOMElement', function (assert) {
var isDOMElement = Highcharts.isDOMElement,
// Mock an ES6 class
classes = {
constructor: function TestClass() {}
};

assert.strictEqual(
isHTMLElement("a"),
isDOMElement("a"),
false,
'String is not a HTML Element'
);
assert.strictEqual(
isHTMLElement(1),
isDOMElement(1),
false,
'Number is not a HTML Element'
);
assert.strictEqual(
isHTMLElement(true),
isDOMElement(true),
false,
'Boolean is not a HTML Element'
);
assert.strictEqual(
isHTMLElement(null),
isDOMElement(null),
false,
'null is not a HTML Element'
);
assert.strictEqual(
isHTMLElement(undefined),
isDOMElement(undefined),
false,
'undefined is not a HTML Element'
);
assert.strictEqual(
isHTMLElement([1]),
isDOMElement([1]),
false,
'Array is not a HTML Element'
);
assert.strictEqual(
isHTMLElement({ a: 1 }),
isDOMElement({ a: 1 }),
false,
'Object is not a HTML Element'
);
assert.strictEqual(
isHTMLElement(classes),
isDOMElement(classes),
false,
'Object classes is not a HTML Element'
);
assert.strictEqual(
isHTMLElement(document.createElement('div')),
isDOMElement(document.createElement('div')),
true,
'HTMLElement is a HTML Element'
);
assert.strictEqual(
isHTMLElement(function Test() {}),
isDOMElement(function Test() {}),
false,
'Function is not a HTML Element'
);
Expand Down

2 comments on commit af467f2

@TorsteinHonsi
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conflicts again... This is already fixed in the master. Remember to merge the master into hc-fixes before each commit!

@KacperMadej
Copy link

@KacperMadej KacperMadej commented on af467f2 Apr 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TorsteinHonsi I am merging master into hc5-fixes. I will remove the test fixes (the only difference between this commit and the one on the master branch) and will create a new commit for it - for easier cherry-picking.

EDIT: It's here: 30f3e74

Please sign in to comment.