doc = Nokogiri::HTML::Document.parse(<<-eohtml) <html> <head> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> </head> <body> <form> <input name="email" disabled="disabled" /> <input name="id" /> </form> </body> </html> eohtml p doc.css("input:disabled").count # >> 2 # ~> /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 `<main>'' ************************ Why the errors are throwing up? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/25709aaec942e4b1076317d23379aeac%40ruby-forum.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
On Sat, Jun 1, 2013 at 12:33 AM, Love U Ruby <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> p doc.css("input:disabled").count> Why the errors are throwing up?What makes you think that''s valid syntax? -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yC6ps5SXMOt9SZ%2BA7L4BqjrwNnBoctLCM%3D9R4WfVEhmSQ%40mail.gmail.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Hassan Schroeder wrote in post #1110918:> On Sat, Jun 1, 2013 at 12:33 AM, Love U Ruby <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> > wrote: > >> p doc.css("input:disabled").count > >> Why the errors are throwing up? > > What makes you think that''s valid syntax? > > -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > http://about.me/hassanschroeder > twitter: @hassanHere I have seen. http://api.jquery.com/disabled-selector/ -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/bf2a5137466783f13d40ccdb0134608f%40ruby-forum.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
On Sat, Jun 1, 2013 at 8:04 AM, Love U Ruby <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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 Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yBc-C091avo60o_-5JyGmWnXcoufuj8tcDG_eWbVfKufg%40mail.gmail.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Hassan Schroeder wrote in post #1110922:> On Sat, Jun 1, 2013 at 8:04 AM, Love U Ruby <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> > 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.. :( -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6dfeef0eacf4d5242954121edfa2a852%40ruby-forum.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Hassan Schroeder
2013-Jun-01 15:53 UTC
Re: Re: Re: Nokogiri#css("input:disabled") not working
On Sat, Jun 1, 2013 at 8:35 AM, Love U Ruby <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> But Nokogiri supports jQuery css rulesWhere in the Nokogiri docs does it say that? Where in the docs is an example of the syntax you are trying to use? -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yCxtnueHHCztdYHXKEoji4qkMerPWxpbUHkgzqoedrkCg%40mail.gmail.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Hassan Schroeder 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) <html> <head> <style> div { float:left; } span { color:blue; } </style> </head> <body> <div> <p>div1 p1</p> <p>div1 p2</p> <p>div1 p3</p> <p>div1 p4</p> </div> <div> <p>div2 p1</p> <p>div2 p2</p> <p>div2 p3</p> <p>div2 p4</p> </div> </body> </html> eohtml p doc.css("div p:eq(2)").map { |e| e.text } # >> ["div1 p2", "div2 p2"] -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a10964d78e1f826d34f1080c036c98d2%40ruby-forum.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Hassan Schroeder
2013-Jun-01 16:33 UTC
Re: Re: Re: Re: Nokogiri#css("input:disabled") not working
On Sat, Jun 1, 2013 at 9:17 AM, Love U Ruby <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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 Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yAfBVN%2Bc1yeNzQr60QjrbStr7qKcfMwub54O-bJWpRwhA%40mail.gmail.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Love U Ruby
2013-Jun-01 16:47 UTC
Re: Re: Re: Re: Nokogiri#css("input:disabled") not working
Hassan Schroeder wrote in post #1110932:> On Sat, Jun 1, 2013 at 9:17 AM, Love U Ruby <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> > 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. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/938c62fe4cbbf7c4d18d5958b07f0b9e%40ruby-forum.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Hassan Schroeder
2013-Jun-01 17:15 UTC
Re: Re: Re: Re: Re: Nokogiri#css("input:disabled") not working
On Sat, Jun 1, 2013 at 9:47 AM, Love U Ruby <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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 Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yC5yx6ypJc%2BD1bcPhUBpSbvwy7bCQfvVwVhjxqsVg_80w%40mail.gmail.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Love U Ruby
2013-Jun-01 17:28 UTC
Re: Re: Re: Re: Re: Nokogiri#css("input:disabled") not working
Hassan Schroeder wrote in post #1110937:> On Sat, Jun 1, 2013 at 9:47 AM, Love U Ruby <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> > 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 lease share. :) Thanks. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f0e879400c0dd5ca1699a3dcd9c70e60%40ruby-forum.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Tamara Temple
2013-Jun-01 19:40 UTC
Re: Re: Re: Re: Re: Re: Nokogiri#css("input:disabled") 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]: <html><body> <style>input:disabled {background: #0F0; color: #F00;}</style> <input type="text" id="greenjunk" name="greenjunk" value="nada" disabled /> <input type="text" id="name" name="name" value="Joe" /> <input type="submit" id="submit" name="submit" value="submit" /> </body></html> 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] https://developer.mozilla.org/en-US/docs/Web/CSS/:disabled [2] see this ugly thing at https://dl.dropboxusercontent.com/u/571329/Examples/greenjunk.html -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/51aa4e42.2a14320a.32a4.ffffc476%40mx.google.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Love U Ruby
2013-Jun-01 20:01 UTC
Re: Re: Re: Re: Re: Re: Nokogiri#css("input:disabled") not working
Tamara Temple wrote in post #1110947:> [1] https://developer.mozilla.org/en-US/docs/Web/CSS/:disabled > [2] see this ugly thing at > https://dl.dropboxusercontent.com/u/571329/Examples/greenjunk.htmlSee the issue - https://github.com/sparklemotion/nokogiri/issues/907 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/31da12e729f9dd7ace0d41a2898ffba5%40ruby-forum.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.