是否有人知道一个好的javascript库来获取DOM中给定元素的原始(即未计算)样式?换句话说,可以使用某些东西在Firebug的样式选项卡中生成结果。与Firebug一样,它应该考虑继承,快捷方式属性以及CSS的所有其他细微差别。
答案 0 :(得分:1)
根据评论,您可能会对一个不错的firebug lite bookmarkmarklet链接感兴趣:
http://www.latentmotion.com/how-to-use-firebug-in-ie6-and-all-other-browsers/
在我找到firebug lite之前,我开始使用自己的自定义版本:
http://latentmotion.com/jquery-bookmarklet/
(注意:单击“显示框边界”,然后单击页面上的html标记。您将看到样式属性显示在右侧。它也可以用作书签)
为了完成上述书签,我使用了(链接和数组):
http://www.latentmotion.com/jquery-bookmarklet/example-jquery-bookmarklet.js
var allStyles = ["azimuth","background" ,"backgroundAttachment","backgroundColor","backgroundImage","backgroundPosition","backgroundRepeat","border","borderBottom","borderBottomColor","borderBottomStyle","borderBottomWidth","borderCollapse","borderColor","borderLeft","borderLeftColor","borderLeftStyle","borderLeftWidth","borderRight","borderRightColor","borderRightStyle","borderRightWidth","borderSpacing","borderStyle","borderTop","borderTopColor","borderTopStyle","borderTopWidth","borderWidth","bottom","captionSide","clear","clip","color","content","counterIncrement","counterReset","cssFloat","cue","cueAfter","cueBefore","cursor","direction","display","elevation","emptyCells","font","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","height","left","letterSpacing","lineHeight","listStyle","listStyleImage","listStylePosition","listStyleType","margin","marginBottom","marginLeft","marginRight","marginTop","markerOffset","marks","maxHeight","maxWidth","minHeight","minWidth","orphans","outline","outlineColor","outlineStyle","outlineWidth","overflow","padding","paddingBottom","paddingLeft","paddingRight","paddingTop","page","pageBreakAfter","pageBreakBefore","pageBreakInside","pause","pauseAfter","pauseBefore","pitch","pitchRange","playDuring","position","quotes","richness","right","size","speak","speakHeader","speakNumeral","speakPunctuation","speechRate","stress","tableLayout","textAlign","textDecoration","textIndent","textShadow","textTransform","top","unicodeBidi","verticalAlign","visibility","voiceFamily","volume","whiteSpace","widows","width","wordSpacing","zIndex"];
如果有人知道更好的方式,我也有兴趣听到它:)