Re: [PATCH] removing nodes from a dom

folkert <[email protected]> Sun, 12 Jul 2015 20:40:02 +0200
Newsgroups gmane.comp.web.html-tidy.devel
Organization www.smartwinning.info
Message-ID <[email protected]>
Thanks for the reply.
I've merged my patch (which has been extended for an attribute-deleter
as well) into my github-fork. If all went well you've received a
pull-request.

Note that I DID test the node-delete (works for me, no valgrind errors
either) but I did not yet test the attribute-delete (altough it
compiles cleanly).

On Sun, Jul 12, 2015 at 08:30:48PM +0200, Tidy Project wrote:
> Hi folkert,
> =

> The current development of tidy is here -
> =

> https://github.com/htacg/tidy-html5
> =

> It looks like a simple API extension, at no cost ;=3D))
> =

> If you open an issue here -
> =

> https://github.com/htacg/tidy-html5/issues
> =

> it will certainly be considered... either as a patch, or PR...
> =

> Thanks...
> =

> Geoff.
> =

> =

> =

> On Sun, Jul 12, 2015 at 2:36 PM, folkert <[email protected]> wrote:
> =

> > Hi,
> >
> > Here's a patch for (lib-)tidy which allows developers to remove a node
> > from a dom.
> > I added this function so that I can use (lib-)tidy in a piece of code
> > which removes dangerous html (dangerous for my use-case). For example
> > scripting, iframes, etc.
> > Please consider including it. Thanks.
> >
> >
> > diff -uNrBbd tidy/include/tidy.h tidy-new/include/tidy.h
> > --- tidy/include/tidy.h 2008-04-22 11:00:42.000000000 +0000
> > +++ tidy-new/include/tidy.h     2015-07-12 11:59:11.251382612 +0000
> > @@ -801,6 +801,9 @@
> >  TIDY_EXPORT TidyNode TIDY_CALL    tidyGetHead( TidyDoc tdoc );
> >  TIDY_EXPORT TidyNode TIDY_CALL    tidyGetBody( TidyDoc tdoc );
> >
> > +/* remove a node */
> > +TIDY_EXPORT TidyNode TIDY_CALL    tidyDiscardElement( TidyDoc tdoc,
> > TidyNode tnod );
> > +
> >  /* parent / child */
> >  TIDY_EXPORT TidyNode TIDY_CALL    tidyGetParent( TidyNode tnod );
> >  TIDY_EXPORT TidyNode TIDY_CALL    tidyGetChild( TidyNode tnod );
> > diff -uNrBbd tidy/src/tidylib.c tidy-new/src/tidylib.c
> > --- tidy/src/tidylib.c  2008-06-18 20:18:54.000000000 +0000
> > +++ tidy-new/src/tidylib.c      2015-07-12 11:55:04.745221204 +0000
> > @@ -1499,6 +1499,15 @@
> >    return tidyImplToNode( nimp->content );
> >  }
> >
> > +/* remove a node */
> > +TidyNode TIDY_CALL    tidyDiscardElement( TidyDoc tdoc, TidyNode tnod )
> > +{
> > +  TidyDocImpl* doc =3D tidyDocToImpl( tdoc );
> > +  Node* nimp =3D tidyNodeToImpl( tnod );
> > +  Node* next =3D TY_(DiscardElement)( doc, nimp );
> > +  return tidyImplToNode( next );
> > +}
> > +
> >  /* siblings */
> >  TidyNode TIDY_CALL    tidyGetNext( TidyNode tnod )
> >  {
> >
> >
> > Folkert van Heusden
> >
> > --
> > MultiTail er et flexible tool for =E5 kontrolere Logfiles og commandoer.
> > Med filtrer, farger, sammenf=F8ringer, forskeliger ansikter etc.
> > http://www.vanheusden.com/multitail/
> > ----------------------------------------------------------------------
> > Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
> >
> >
> > -----------------------------------------------------------------------=
-------
> > Don't Limit Your Business. Reach for the Cloud.
> > GigeNET's Cloud Solutions provide you with the tools and support that
> > you need to offload your IT needs and focus on growing your business.
> > Configured For All Businesses. Start Your Cloud Today.
> > https://www.gigenetcloud.com/
> > _______________________________________________
> > Tidy-develop mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/tidy-develop
> >


Folkert van Heusden

-- =

Wintips voor de staatsloterij? http://www.slimwinnen.nl/
     Meer weten over Bitcoins? http://www.vanheusden.com/bitcoins/
          Meer weten over TOR? http://www.vanheusden.com/tor/
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com

---------------------------------------------------------------------------=
---
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/