best way to filter out non-representational elements

Posted by nonano on Stack Overflow See other posts from Stack Overflow or by nonano
Published on 2010-05-24T08:24:27Z Indexed on 2010/05/24 8:31 UTC
Read the original article Hit count: 174

Filed under:
|
|
|

Hi there, I am using phpQuery in order to apply some twaks to editorial content. As its syntax is the same as jQuery, I consider this a dom scripting issue.

To get rid of elements which are not representing anything, but wrapping other stuff (like the div in <div><p>blah</p></div> I came up with this selector:

['div:not([align][class][id][style][title][dir][lang][onclick][ondblclick][onmousedown]
[onmouseup][onmouseover][onmousemove][onmouseout][onkeypress][onkeydown][onkeyup])']

which looks quite monstrous for a selector simply aming on Divs which just do not have any (valid) attribute.

I guess there must be a more straight-forward way to accomplish that, right?

Edit: Oh, and I just noticed that it even doesn't do wat I intended to ...

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about dom