它在这里说http://www.w3.org/TR/html-markup/style.html#style:
允许的父元素
任何可以包含元数据元素,div,noscript,section,article的元素
这<style>或多或少让每一个地方(如果<div>是允许的),但是,在另一方面,我发现了一个更详细的信息在这里http://www.w3.org/TR/2012/WD-html5-20121025/the-style -element.html#ATTR式作用域
可以使用此元素的上下文:(注释:样式)
Run Code Online (Sandbox Code Playgroud)If the scoped attribute is absent: where metadata content is expected. If the scoped attribute is absent: in a noscript element that is a child of a head element. If the scoped attribute is present: where flow content is expected, but before any other flow content other than inter-element whitespace, and not as the child of an element whose content model is transparent.
以及本文档的后面部分:
scoped属性是布尔属性.如果存在,则表示样式仅适用于以style元素的父元素为根的子树,而不是整个Document.
如果存在scoped属性且元素具有父元素,则style元素必须是其元素之外的元素的第一个节点,而不是元素间空格,并且父元素的内容模型必须不具有透明组件.
这读起来就像(或将会)"两个不同的 …
我正在研究技术图纸(svg/ruby)的解决方案.我想操纵矩形,并add!在这个类中有一个方法:
class Rect
def add!(delta)
@x1+=delta
... # and so on
self
end
end
Run Code Online (Sandbox Code Playgroud)
我还需要一个add返回a Rect但不操作的方法self:
def add(delta)
r=self.dup/clone/"copy" # <-- not realy the 3 and no quotes, just in text here
r.add! delta
end
Run Code Online (Sandbox Code Playgroud)
dup并且clone不要做我的事情但是:
def copy; Marshal.load(Marshal.dump(self)); end
Run Code Online (Sandbox Code Playgroud)
确实.
为什么普通Ruby中不存在这样的基本功能?请不要告诉我,我可以扭转add和add!,让add做的工作,并add!调用它.
简短说明(我们在浏览器调试器网络选项卡中):
AJAX GET /page/42 takes ~20s
replay/resend this XHR takes ~15s
open this XHR in new tab takes ~1.5s (only!)
replay/resend this XHR takes ~15s (again)
Run Code Online (Sandbox Code Playgroud)
仅在开发中发生
总是(和跨浏览器)重现能力
Rails 3.2.22.5
HAML失去了时间(非常肯定)
我正在开发一个HTML编辑器来设计打印页面.这个编辑器 - 让我们说 - 全面.
启动时我必须渲染完整的编辑器HAML(~1000行),这需要不到5秒(除非在rails启动后首先).这相当快.
基本结构看起来像这样(伪HAML,每行是部分,数字是〜渲染时间)部分计数(n)通常在10到15左右
editor_layout
editor (~5s)
edit_background (~1.5s)
the_page (0.1s*n)
section_1
.
.
section_n
dialog_1
dialog_2
.
.
dialog_42
Run Code Online (Sandbox Code Playgroud)
打印时(PDF)看起来像
print_layout (~1.5s)
the_page (0.1s*n)
section_1
.
.
section_n
Run Code Online (Sandbox Code Playgroud)
到目前为止,在开发环境中特别好,特别好.
但是当我必须在编辑器中更改页面并使用AJAX调用新页面以获得内部HTML时
no_layout
edit_background (~15s)
the_page (1s*n)
section_1
.
.
section_n
Run Code Online (Sandbox Code Playgroud)
动作需要大约15秒(!).时间来自渲染一个部分现在需要1秒而不是100毫秒.如果我在新的浏览器选项卡中打开相同的URL,我将恢复到通常的1.5秒.
我不知道为什么.
使它更奇怪:
我可以用AJAX重新加载(重新渲染)编辑器的任何(HTML)部分,这看起来像
/page/42/edit?inner-html=background, dialog_1, …Run Code Online (Sandbox Code Playgroud) 我在用 wkhtmltopdf 0.12.1 (with patched qt)
虽然大多数CSS3的东西 - 至少我使用的 - 工作正常,有些需要一个' -webkit-'前缀,比如transform
其他人,border-image似乎只使用短形式(和前缀).即.border-image-xxx,好像不起作用,SVG似乎根本不受支持
所以问题是:我如何才能找到CSS3支持的级别wkhtmltopdf?由于拼写错误,试验和错误是非常耗时的,并且可能是错误的.
edid:基于答案
我正在测试Chrome,FF,IE,Opera和Safari(尽可能使用Windows),wkhtmltopdf就像一个自己的浏览器 - sorringliy它看起来不够大,无法在"官方"列表中获得一席之地
我只花了几个小时来完成以下场景:(全部回归基础)
$('#typo').bind('click' etc ...
Run Code Online (Sandbox Code Playgroud)
我在选择器中输入了一个拼写错误,但jQuery解析了
$('#funny something out there').bind(...
Run Code Online (Sandbox Code Playgroud)
没有任何警告.
当你的选择器什么都没有时,是否有可能告诉jQuery引发错误?
像这样的东西:
$('#typo', alert('Stupid, nothing here! like '+ '#typo))
Run Code Online (Sandbox Code Playgroud)
编辑
我跟我说话了:
$('#typo', alert('Stupid, nothing here! like '+ '#typo))
Run Code Online (Sandbox Code Playgroud)
不是一个解决方案.我必须知道错误在哪里扩展选择器
我尝试只使用:我的应用程序中关键词的符号.我尝试严格决定:symbol => logic或string => UI/language specific
但是我每个JSON也得到一些"值"(即选项等等),因为JSON中没有:符号,所有调用的哈希都具有"with_indifferent_access"属性.
但是:数组有相同的东西吗?像那样
a=['std','elliptic', :cubic].with_indifferent_access
a.include? :std => true
Run Code Online (Sandbox Code Playgroud)
?
编辑:为标签添加了rails
我有这个代码:
def with_else
puts 'we enter something funny'
if true
puts "yes"
'return YES'
end
'return what?'
else
puts 'no'
'return else -> no'
end
puts with_else
Run Code Online (Sandbox Code Playgroud)
输出是这样的:
we enter something funny
yes
no
return else -> no
Run Code Online (Sandbox Code Playgroud)
为什么我没有收到错误?什么def/ else/ end是什么意思?
我有一个SVG绘图,我想点击它上面的线条.这很好,如果你有时真的很瘦的家伙.
有没有人有一个想法,如何让线更容易点击 - 而不只是扩大"笔画宽度"?
我尝试使用两条线(一条白色厚一条黑色薄),但渲染顺序会破坏图形的一部分.
任何的想法?
场景很简单-我使用wkhhtmltopdf创建PDF,有时会遇到类似问题
window.performance
Run Code Online (Sandbox Code Playgroud)
此版本不支持。
因此脚本未完全执行。
到目前为止Safari,我发现此类错误的方法是使用非常古老的Windows 浏览器,该浏览器帮助我发现了这些错误。
但是现在我的旧wkhtmtlopdf出现了脚本错误,甚至在Windows Safari中也没有显示。
我发现它(或者不是真的)是通过大量繁琐的脚本更改(注释掉了一半)来实现的,但是我想知道是否有一种方法可以在解析时用wkhtmtlopdf获取正确的错误。