Bug fix: DOM tree inspection
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.0.0-beta2-20170714-1007" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
+<plugin id="cordova-plugin-googlemaps" version="2.0.0-beta2-20170714-1015" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>cordova-plugin-googlemaps</name>
<js-module name="BaseClass" src="www/BaseClass.js">
<runs />

MODIFY
www/Common.js
www/Common.js
@@ -213,28 +213,22 @@ function getDivRect(div) {
};
}
-function getAllChildren(root) {
- if (!root) {
- return [];
- }
-
var ignoreTags = [
"pre", "textarea", "p", "form", "input", "table", "caption",
"canvas", "ion-content", "ion-app", "ion-nav", "svg"
];
var ignoreClasses = ["nav-decor", "ion-page", "fixed-content"];
- var list = [];
-
- if (window.document.querySelectorAll) {
- // Android: v4.3 and over
- // iOS safari: v9.2 and over
- var childNodes = root.querySelectorAll("*");
- var allClickableElements = Array.prototype.slice.call(childNodes);
- list = allClickableElements.filter(function(node) {
+
+function shouldWatchByNative(node) {
+ if (node.nodeType !== Node.ELEMENT_NODE || !node.parentNode) {
+ if (node === document.body) {
+ return true;
+ }
+ return false;
+ }
+
var tagName = node.tagName.toLowerCase();
- if (node !== root &&
- shouldWatchByNative(node) &&
- ignoreTags.indexOf(tagName) == -1) {
+ if (ignoreTags.indexOf(tagName) == -1) {
var classNames = (node.className || "").split(" ");
var matches = classNames.filter(function(clsName) {
@@ -243,44 +237,10 @@ function getAllChildren(root) {
if (matches && matches.length > 0) {
return false;
}
- return true;
} else {
return false;
}
- });
- } else {
- var node, tagName, classNames, i, j, hit;
- var clickableElements = root.getElementsByTagName("*");
- for (i = 0; i < clickableElements.length; i++) {
- node = clickableElements[i];
- tagName = node.tagName.toLowerCase();
- if (shouldWatchByNative(node) &&
- ignoreTags.indexOf(tagName) == -1) {
- classNames = (node.className || "").split(" ");
- hit = false;
- for (j = 0; j < classNames.length; j++) {
- if (ignoreClasses.indexOf(classNames[j]) > -1) {
- hit = true;
- break;
- }
- }
- if (!hit) {
- list.push(node);
- }
- }
- }
- }
-
- return list;
-}
-function shouldWatchByNative(node) {
- if (node.nodeType !== Node.ELEMENT_NODE || !node.offsetParent) {
- if (node === document.body) {
- return true;
- }
- return false;
- }
var visibilityCSS = getStyle(node, 'visibility');
var displayCSS = getStyle(node, 'display');
var opacityCSS = getStyle(node, 'opacity');
@@ -583,7 +543,6 @@ module.exports = {
deleteFromObject: deleteFromObject,
getDivRect: getDivRect,
getDomInfo: getDomInfo,
- getAllChildren: getAllChildren,
isDom: isDom,
parseBoolean: parseBoolean,
HLStoRGB: HLStoRGB,

Bug fix: DOM tree inspection