Skip to content

Commit

Permalink
Deprecate contains function in domNamed | Fixes metal#367
Browse files Browse the repository at this point in the history
  • Loading branch information
diegonvs committed Mar 27, 2018
1 parent eea0bbb commit 2ce01ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions packages/metal-dom/src/domNamed.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,11 @@ export function buildFragment(htmlString) {
* Checks if the first element contains the second one.
* @param {!Element} element1
* @param {!Element} element2
* @deprecated Use element1.contains(element2) directly instead of this method
* @return {boolean}
*/
export function contains(element1, element2) {
if (isDocument(element1)) {
// document.contains is not defined on IE9, so call it on documentElement instead.
return element1.documentElement.contains(element2);
} else {
return element1.contains(element2);
}
return element1.contains(element2);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/metal-dom/src/events.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

import {isServerSide} from 'metal';
import {registerCustomEvent, contains} from './dom';
import {registerCustomEvent} from './dom';
import features from './features';

/**
Expand All @@ -23,7 +23,7 @@ function registerEvents() {
// eslint-disable-next-line
if (
!related ||
(related !== target && !contains(target, related))
(related !== target && !target.contains(related))
) {
event.customType = eventName;
return callback(event);
Expand Down

0 comments on commit 2ce01ff

Please sign in to comment.