File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I select elements of body which are not children of a link tag with Sizzle/Javascript

 
sinan goker
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am newbie in both JS and Sizzle, trying to implement a system
that generates links according to a keyword like Google AdSense do.
I ve searched and decided to use Sizzle CSS Selector for this.

I have an html document and a keyword, I want to search all keywords in
the document body which are not in a link(a, area, etc.) tag.

Sample content



Selector code and replace operation


After changing keywords with links, the output content is



It changes all keywords in the document. The second keyword would not be changed according to my system. Because it has 2 "a" tags like <a><a></a></a>
I need a selector to select elements which are not childen of any link tags.

Any idea?
Thanks.






 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You probably want to use the not selector.

Eric
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic