- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将元素复制到 Tritium 中的给定 CSS 选择器。
Tritum 规范将 copy_to 的签名列为:
copy_to(Text %xpath)
http://tritium.io/simple-mobile/1.0.224#Node.copy_to(Text%20%25xpath)
我正在尝试:
copy_to( CSS_SELECTOR )
例如:
copy_to("#header")
我似乎无法让它工作。
这是氚测试仪 URL:http://tester.tritium.io/4193cf46a239b4ff440cf1b4c36fb703cd22a5a4
最佳答案
不幸的是,由于 CSS 选择器在 Tritium 中的工作方式,这行不通。
根据规范,CSS 选择器被转换为 XPath 本地搜索,这意味着它们是有范围的。
html() {
$("/html") {
$$("#header > img") {
add_class("logo")
}
$$("#content") {
$("./div[@id='courses']"){
$$("a") {
attribute("href", "http://console.moovweb.com/learn/training/getting_started/generate")
}
copy_to(css('#header'), "before")
}
}
}
}
在您的示例中,您的 copy_to
函数在 $("./div[@id='courses']")
的范围内,因此它不会在那里找不到 div#header
。
您必须像这样使用 XPath 选择器:copy_to("/html/body/div[@id='header']","before")
参见此处:http://tester.tritium.io/5f0ae313a4f43038ee4adeb49b81236bfbc5f097
关于moovweb - 我可以在 Tritium 中使用 CSS 选择器来移动/复制元素吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17306103/
站点能否在使用 Tritium 的同时还与您“过滤”来自其请求的任何主机建立开放式套接字连接?假设我想克隆一个站点,该站点使用 WebSockets 来为浏览器聊天客户端保持打开的连接。这些请求是直接
新手问题,我正在处理一个简单的场景:使用 Tritium 更改页面上给定元素的背景颜色和文本。我的页面如下所示: My Text- on Moovweb 在我
我想创建一个在用户访问我的页面后 5 分钟内过期的 cookie。 我知道 add_cookie()功能,但不知道如何将其设置为过期。 最佳答案 您可以在 scripts/response_main.
我有一个普通的标签: ... 我需要它看起来像这样: ... 为什么? jQuery Mobile 功能:http://jquerymobile.com/demos/1.1.1/docs/pa
我正在使用Moovweb SDK我想从任何元素的开头或结尾删除多余的空白。它有时显示为 或者我想删除它,因为它扰乱了我的间距。我怎样才能避免这样做? 谢谢。 最佳答案 您可以使用正则表达式将前导和尾随
我正在使用 Moovweb/Tritium 通过 Zurb Foundation 框架使常规桌面站点响应。 作为其中的一部分,我想创建辅助函数来启用 Foundation 小部件,例如 Uranium
我正在尝试将元素复制到 Tritium 中的给定 CSS 选择器。 Tritum 规范将 copy_to 的签名列为: copy_to(Text %xpath) http://tritium.io/s
我正在尝试将元素复制到 Tritium 中的给定 CSS 选择器。 Tritum 规范将 copy_to 的签名列为: copy_to(Text %xpath) http://tritium.io/s
我有一个 javascript 片段,我需要在每个页面上注入(inject)它以触发我的谷歌分析。我尝试使用 inject 并不断收到错误: inject("// load ga.js if it d
我在另一篇文章中看到了一种非常手动的方法:How do I add a query parameter to a URL? 这看起来不是很直观,但是有人提到了使用即将推出的“URL 范围”来完成此操作
标签转换为
我正在使用 Moovweb SDK 并正在针对移动设备优化我的个人桌面网站。 如何转换我所有的标记到 标签?我真的不想手动做!搜索和替换??哈哈 最佳答案 您可以使用 name() 函数来更改元素的名
我是一名优秀的程序员,十分优秀!