public final void removeAttribute ( final Element root , final String selector , final String attribute ) { final Iterable < Element > elements ; // Elements selected checkNotNull ( root , "Received a null pointer as root element" ) ; checkNotNull ( selector , "Received a null pointer as selector" ) ; checkNotNull ( attribute , "Received a null pointer as attribute" ) ; // Selects and iterates over the elements elements = root . select ( selector ) ; for ( final Element element : elements ) { element . removeAttr ( attribute ) ; } }
Finds a set of elements through a CSS selector and removes the received attribute from them if they have it .