Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Can';t访问Android设备上的Node.childNodes getter_Javascript_Android_Webview_Android Webview - Fatal编程技术网

Javascript Can';t访问Android设备上的Node.childNodes getter

Javascript Can';t访问Android设备上的Node.childNodes getter,javascript,android,webview,android-webview,Javascript,Android,Webview,Android Webview,我正在Android设备上调试一个问题。(使用仿真器,但在许多设备中都可以复制)。 我正在使用Android WebView浏览器打开我的页面 WebView in com.google.android.gms (39.0.0.0) 我正在选择body元素并成功地读取它的childNodes属性。 但是我在节点.prototype上找不到子节点getter,在prototype链的父节点上也找不到 const el = document.querySelector('body') undefi

我正在Android设备上调试一个问题。(使用仿真器,但在许多设备中都可以复制)。 我正在使用Android WebView浏览器打开我的页面

WebView in com.google.android.gms (39.0.0.0)
我正在选择
body
元素并成功地读取它的
childNodes
属性。 但是我在
节点.prototype上找不到
子节点
getter,在prototype链的父节点上也找不到

const el = document.querySelector('body')
undefined
el instanceof Node
true
el instanceof HTMLBodyElement
true
el instanceof HTMLElement
true
el.childNodes.length
61
Object.getOwnPropertyDescriptor(Node.prototype,'childNodes')
undefined
Object.getOwnPropertyDescriptor(HTMLBodyElement.prototype,'childNodes')
undefined
Object.getOwnPropertyDescriptor(HTMLElement.prototype,'childNodes')
undefined
主体元素原型链:

HTMLBodyElement
HTMLElement
Element
Node 
EventTarget
Object 
null
childNodes
不作为
对象存在。getOwnPropertyDescriptor
在这些节点上都不存在


有什么方法可以让我找到如何将这个
childNodes
属性添加到
节点。prototype
并获得这个函数吗?

我没有找到在这些特定的旧浏览器中获得getter函数的方法(我想是浏览器的一个功能阻止了对它们的访问)

我做了一种变通方法:

 const descriptor = Object.getOwnPropertyDescriptor(object, functionName);
  if (descriptor?.get) {
    return descriptor.get;
  }
  if (descriptor?.value) {
    return descriptor.value;
  }
  // if no access - just a return a function that returns this property
  return function () {
    return this[functionName];
  };

你好你找到这个问题的解决方案了吗?嘿@Karthikkumar,我没有设法解决它,但找到了某种解决办法。我更新了我的答案,希望能有所帮助。