Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/371.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.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
从Dart编译到Javascript后,document.querySelector找不到_Javascript_Dart_Document_Dart2js - Fatal编程技术网

从Dart编译到Javascript后,document.querySelector找不到

从Dart编译到Javascript后,document.querySelector找不到,javascript,dart,document,dart2js,Javascript,Dart,Document,Dart2js,在编译为javascript后,试图在文档对象上使用querySelector查找元素时,我得到了null。以下是Dart代码: 真空总管{ printdocument.querySelector'body';//=>null } 这也会产生范围误差: document.getElementsByTagName'body'[0]/=>范围错误,列表显然为空 虽然dart代码在Dartium中运行得很好。奇怪,但body元素不需要querySelector。 只需使用document.body,但

在编译为javascript后,试图在文档对象上使用querySelector查找元素时,我得到了null。以下是Dart代码:

真空总管{ printdocument.querySelector'body';//=>null } 这也会产生范围误差:

document.getElementsByTagName'body'[0]/=>范围错误,列表显然为空 虽然dart代码在Dartium中运行得很好。

奇怪,但body元素不需要querySelector。 只需使用document.body,但body元素不需要querySelector。
只要使用document.body就可以了。我在这一部分中包括了脚本,在里面的所有内容完成后,我应该完成它。

把它弄明白了。我在部分中包含了脚本,在里面包含了所有内容之后,我应该完成它。

仍然不走运,document.body仍然不走运,document.body prints nullI还应该添加DOM中肯定有一个元素。我还应该添加DOM中肯定有一个元素。对于需要等待文档解析的脚本,应该使用defer。不幸的是,发布构建并没有转换延迟的dart脚本。对于需要等待文档解析的脚本,hmmone应该使用defer。不幸的是,发布构建并没有转换延迟的dart脚本。让我走的东西,嗯