“dart:html”和“dart:html”之间有什么区别?和“dart:dom”包? [英] What's the difference between "dart:html" and "dart:dom" package?

查看:679
本文介绍了“dart:html”和“dart:html”之间有什么区别?和“dart:dom”包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从一些Dart示例开始。然后我想用 document.query('#someId')查询DOM 这里,但似乎文档中没有查询方法。另外,通过`new Element.tag('p')创建一个新元素不起作用。



然后我发现,当我将导入的包从 dart:dom 更改为 dart:html 。但是使用它们给了我一堆<_ c $ c> _XYZ 的重复定义。



所以我不知道:


  1. dart:html 之间有什么区别dart:dom
  2. 为什么我不能同时使用



解决方案

对所有答案的更新,可能使这个问题不再适用是dart:dom已被弃用。 p>

请参阅此帖子 a>在dartlang网站上。


I'm starting with some of the Dart examples. Then I wanted to query the DOM with document.query('#someId') as described here, but it seems there was no query method in document. Also creating a new element by `new Element.tag('p') doesn't work.

Then I figure out that it will work, when I change the imported package from dart:dom to dart:html. But using both of them gives me a bunch of duplicate definition of _XYZ.

So I wonder:

  1. what's the difference between dart:html and dart:dom package
  2. which one should I use
  3. why can't I use both

解决方案

An update to all the answers, and probably makes this question no longer applicable is that dart:dom has been deprecated.

See this post on dartlang website.

这篇关于“dart:html”和“dart:html”之间有什么区别?和“dart:dom”包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆