Nokogiri#css("input:disabled") not working

doc = Nokogiri::HTML::Document.parse(<<-eohtml)

eohtml

p doc.css(“input:disabled”).count

~>

/home/kirti/.rvm/gems/ruby-2.0.0-p0/gems/nokogiri-1.5.9/lib/nokogiri/xml/node.rb:159:in
`evaluate’: xmlXPathCompOpEval: function disabled not found
(RuntimeError)

~> from

/home/kirti/.rvm/gems/ruby-2.0.0-p0/gems/nokogiri-1.5.9/lib/nokogiri/xml/node.rb:159:in
`block in xpath’

~> from

/home/kirti/.rvm/gems/ruby-2.0.0-p0/gems/nokogiri-1.5.9/lib/nokogiri/xml/node.rb:150:in
`map’

~> from

/home/kirti/.rvm/gems/ruby-2.0.0-p0/gems/nokogiri-1.5.9/lib/nokogiri/xml/node.rb:150:in
`xpath’

~> from

/home/kirti/.rvm/gems/ruby-2.0.0-p0/gems/nokogiri-1.5.9/lib/nokogiri/xml/node.rb:214:in
`css’

~> from -:69:in `’


Why the errors are throwing up?

On Sat, Jun 1, 2013 at 12:33 AM, Love U Ruby [email protected]
wrote:

p doc.css(“input:disabled”).count

Why the errors are throwing up?

What makes you think that’s valid syntax?

–
Hassan S. ------------------------ [email protected]

twitter: @hassan

On Sat, Jun 1, 2013 at 8:04 AM, Love U Ruby [email protected]
wrote:

What makes you think that’s valid syntax?

Here I have seen. http://api.jquery.com/disabled-selector/

Uh, that’s nice. But your question is about Nokogiri, not jQuery.

–
Hassan S. ------------------------ [email protected]

twitter: @hassan

Hassan S. wrote in post #1110918:

On Sat, Jun 1, 2013 at 12:33 AM, Love U Ruby [email protected]
wrote:

p doc.css(“input:disabled”).count

Why the errors are throwing up?

What makes you think that’s valid syntax?

–
Hassan S. ------------------------ [email protected]
Hassan Schroeder | about.me
twitter: @hassan

Here I have seen. http://api.jquery.com/disabled-selector/

Hassan S. wrote in post #1110922:

On Sat, Jun 1, 2013 at 8:04 AM, Love U Ruby [email protected]
wrote:

What makes you think that’s valid syntax?

Here I have seen. http://api.jquery.com/disabled-selector/

Uh, that’s nice. But your question is about Nokogiri, not jQuery.

But Nokogiri supports jQuery css rules, but I found today some of the
css rules are not working.

Don’t know why… :frowning:

On Sat, Jun 1, 2013 at 8:35 AM, Love U Ruby [email protected]
wrote:

But Nokogiri supports jQuery css rules

Where in the Nokogiri docs does it say that? Where in the docs is
an example of the syntax you are trying to use?

–
Hassan S. ------------------------ [email protected]

twitter: @hassan

Hassan S. wrote in post #1110928:

Where in the Nokogiri docs does it say that? Where in the docs is
an example of the syntax you are trying to use?

see below:

require “nokogiri”
doc = Nokogiri::HTML::Document.parse(<<-eohtml)

div { float:left; } span { color:blue; }

div1 p1

div1 p2

div1 p3

div1 p4

div2 p1

div2 p2

div2 p3

div2 p4

eohtml

p doc.css(“div p:eq(2)”).map { |e| e.text }

>> [“div1 p2”, “div2 p2”]

On Sat, Jun 1, 2013 at 9:17 AM, Love U Ruby [email protected]
wrote:

Where in the Nokogiri docs does it say that? Where in the docs is
an example of the syntax you are trying to use?

see below:

Uh, as I said – in the docs?

p doc.css(“div p:eq(2)”)

And in this case, what do you think ‘eq’ is ?

–
Hassan S. ------------------------ [email protected]

twitter: @hassan

Hassan S. wrote in post #1110932:

On Sat, Jun 1, 2013 at 9:17 AM, Love U Ruby [email protected]
wrote:

Where in the Nokogiri docs does it say that? Where in the docs is
an example of the syntax you are trying to use?

see below:

Uh, as I said – in the docs?

p doc.css(“div p:eq(2)”)

And in this case, what do you think ‘eq’ is ?

This is a jQuery extension, and usable in Nokogiri. But some of the
rules are not working.

So here is something I don’t quite understand. According to [1],
“input:disabled” is a quite valid CSS selector.

Given this[2]:

input:disabled {background: #0F0; color: #F00;}

Why wouldn’t doc.css(“input:disabled”) also work? Clearly it doesn’t,
but I don’t know what it should be. (Noting that xpath would be quite
different, of course.)

[1] :disabled - CSS: Cascading Style Sheets | MDN
[2] see this ugly thing at
https://dl.dropboxusercontent.com/u/571329/Examples/greenjunk.html

Hassan S. wrote in post #1110937:

On Sat, Jun 1, 2013 at 9:47 AM, Love U Ruby [email protected]
wrote:

And in this case, what do you think ‘eq’ is ?

This is a jQuery extension, and usable in Nokogiri. But some of the
rules are not working.

Uh, sure. Whatever you want to believe. Good luck!

No sir, I am not telling I am wright. But I used them and working
perfectly. if you have any opinion please share. :slight_smile:

Thanks.

On Sat, Jun 1, 2013 at 9:47 AM, Love U Ruby [email protected]
wrote:

And in this case, what do you think ‘eq’ is ?

This is a jQuery extension, and usable in Nokogiri. But some of the
rules are not working.

Uh, sure. Whatever you want to believe. Good luck!

–
Hassan S. ------------------------ [email protected]

twitter: @hassan

Tamara T. wrote in post #1110947:

[1] :disabled - CSS: Cascading Style Sheets | MDN
[2] see this ugly thing at
https://dl.dropboxusercontent.com/u/571329/Examples/greenjunk.html

See the issue - css selectors not working properly with nokogiri- `:disabled`,`:checked`. · Issue #907 · sparklemotion/nokogiri · GitHub