css-parsing

CSSOMParser errors during parsing

和自甴很熟 提交于 2020-01-05 07:28:25
问题 I am getting the following errors while parsing css file all.css null [1:1763] Error in style rule. Invalid token "!". Was expecting one of: <S>, "}", ",", ";", "/", "+", "-", <HASH>, <STRING>, <URI>, <IMPORTANT_SYM>, "inherit", <EMS>, <EXS>, <LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>, <DIMEN>, <PERCENTAGE>, <NUMBER>, "rgb(", <FUNCTION>, <IDENT>, <UNICODERANGE>. null [1:1763]

CSSOMParser errors during parsing

大憨熊 提交于 2020-01-05 07:28:12
问题 I am getting the following errors while parsing css file all.css null [1:1763] Error in style rule. Invalid token "!". Was expecting one of: <S>, "}", ",", ";", "/", "+", "-", <HASH>, <STRING>, <URI>, <IMPORTANT_SYM>, "inherit", <EMS>, <EXS>, <LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>, <DIMEN>, <PERCENTAGE>, <NUMBER>, "rgb(", <FUNCTION>, <IDENT>, <UNICODERANGE>. null [1:1763]

Getting style information (css) of a node after parsing an html page in Java

北战南征 提交于 2019-12-24 06:37:28
问题 I'm developing a project who analyzes web pages. I use an Java library for HTML parsing, and it returns an org.w3c.dom document. Given a tag node in my dom document, I'd like to know all the CSS info connected to that node (including override/inheritance). How I can do this? Searching on Google, I found some CSS parsers that generate an org.w3c.dom document, but how should I mix them? 回答1: jStyleParser provides exactly this functionality. It parses all the referenced style sheets and maps

Is it possible to parse a stylesheet with Nokogiri?

本小妞迷上赌 提交于 2019-12-22 04:18:08
问题 I've spent my requisite two hours Googling this, and I can not find any good answers, so let's see if humans can beat Google computers. I want to parse a stylesheet in Ruby so that I can apply those styles to elements in my document (to make the styles inlined). So, I want to take something like <style> .mystyle { color:white; } </style> And be able to extract it into a Nokogiri object of some sort. The Nokogiri class "CSS::Parser" (http://nokogiri.rubyforge.org/nokogiri/Nokogiri/CSS/Parser

Do custom CSS properties use one leading dash or two?

大憨熊 提交于 2019-12-17 16:51:15
问题 #elem { -myCustom: 99; } OR #elem { --myCustom: 99; } I have seen both of the above used in examples online. What the difference between the two? Trying to access custom properties in JavaScript returns null.. #elem { -myCustom: 99; } <div id="elem">some text</div> elem = document.getElementById("elem"); style= window.getComputedStyle(elem); value = style.getPropertyValue('-myCustom'); alert(value); 回答1: single leading dash is used for vendor prefixes double leading dash is used for defining

In what order should you list CSS properties for greatest speed?

大兔子大兔子 提交于 2019-12-10 23:57:07
问题 Let's take some CSS properties and place them randomly in our CSS file: outline pseudo-elements Color Properties Background and Border Properties Box Properties Flexible Box Layout Text Properties Text Decoration Properties Font Properties Writing Modes Table Properties Lists Animation If you want to maximize rendering speed, in what order should you list your CSS properties? 回答1: The short answer is: it doesn't matter. To elaborate on that: Say you would implement a browser 1 and get to the

How to parse HTML and get CSS styles

自古美人都是妖i 提交于 2019-12-07 14:07:40
问题 I need to parse HTML and find corresponding CSS styles. I can parse HTML and CSS separataly, but I can't combine them. For example, I have an XHTML page like this: <html> <head> <title></title> </head> <body> <div class="abc">Hello World</div> </body> </html> I have to search for "hello world" and find its class name, and after that I need to find its style from an external CSS file. Answers using Java, JavaScript, and PHP are all okay. 回答1: Use jsoup library in java which is a HTML Parser.

How to parse HTML and get CSS styles

£可爱£侵袭症+ 提交于 2019-12-06 03:56:38
I need to parse HTML and find corresponding CSS styles. I can parse HTML and CSS separataly, but I can't combine them. For example, I have an XHTML page like this: <html> <head> <title></title> </head> <body> <div class="abc">Hello World</div> </body> </html> I have to search for "hello world" and find its class name, and after that I need to find its style from an external CSS file. Answers using Java, JavaScript, and PHP are all okay. Use jsoup library in java which is a HTML Parser. You can see for example here For example you can do something like this: String html="<<your html content>>";

Is it possible to parse a stylesheet with Nokogiri?

醉酒当歌 提交于 2019-12-05 03:56:51
I've spent my requisite two hours Googling this, and I can not find any good answers, so let's see if humans can beat Google computers. I want to parse a stylesheet in Ruby so that I can apply those styles to elements in my document (to make the styles inlined). So, I want to take something like <style> .mystyle { color:white; } </style> And be able to extract it into a Nokogiri object of some sort. The Nokogiri class "CSS::Parser" ( http://nokogiri.rubyforge.org/nokogiri/Nokogiri/CSS/Parser.html ) certainly has a promising name, but I can't find any documentation on what it is or how it works

PHP CSS Parser - Selector Declarations to String

喜夏-厌秋 提交于 2019-12-03 20:21:26
问题 I want to be able to read a CSS file, and be able to extract all declarations of a given selector in to a string. For example, given the following stylesheet: h1 { font-size: 15px; font-weight: bold; font-style: italic; font-family: Verdana, Arial, Helvetica, sans-serif; } div.item { font-size: 12px; border:1px solid #EEE; } I want to be able to call and get div.item, something like: $css->getSelector('div.item'); Which should give me a string like: font-size:12px;border:1px solid #EEE; I