Jump to content

Exclude tag classes and attrubutes from selector results


verdeandrea
 Share

Recommended Posts

Hello girls and guys,

i just saw that if I use a selector on a textarea, for example 

$pages->find('body%=notes')

it also find that key in html classes and attributes. For example it will find

<p class="text-notes">Lorem ipsum dolor sit amet cosectetur.</p>

Is there a way to avoid this anche check only the texts without the html tags?

Thanks!

Link to comment
Share on other sites

I don't think that it is possible. 
As a workaround, you can create additional textarea field where you will populate all sanitized content and then search by this field. 

Link to comment
Share on other sites

hmm... I don't think that's expected behavior.  With more and more developers using data-attributes etc., why should CSS classes etc. show up in a website search result?

With so many things PW does really really well, I'm surprised (I never noticed it though - probably because most sites I build are in German, and I only use English variables, data-attributes and CSS classes / IDs).

Link to comment
Share on other sites

Thanks guys, I also have some multilanguage website, but some words can be the same in all languages (for example: "note", that it is my case).

If there is no solution to that maybe it's good to keep in mind not to use common words as classes or data-attributes in textarea. 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...