webrecorder / wombat

Wombat.js client-side rewriting library
GNU Affero General Public License v3.0
81 stars 30 forks source link

Document `._no_rewrite = true` to turn off rewriting (temporarily) on an element or function #129

Closed Jaifroid closed 9 months ago

Jaifroid commented 9 months ago

It appears that some elements or functions patched by Wombat have the possibility of turning off rewriting temporarily by setting a property ._no_rewrite = true. Is this a consistent property / API that developers can use? If so, it would be well worth documenting it if only in the README of this Repo.

Is there anywhere where such things are documented, other than trawling through the source code?

(Link to PR using this: https://github.com/kiwix/libkiwix/pull/1036).

ikreymer commented 9 months ago

Yes, _no_rewrite is a property, that if set, will skip rewriting for particular elements. It is designed for internal use, since using it can break the rewriting system, so it was never intended for broader use. Most developers aren't using wombat in a custom way.

At this point, what is needed is a much broader documentation / cleanup pass on wombat, so I hesitate to single out this particular property (out of everything else here!), but happy to answer questions about it as they come up.

Jaifroid commented 9 months ago

OK, the reason I asked was because knowing about this would have saved me hours of faffing around trying to find a way to get the underlying values, and #47 seems to be asking for something similar. But +1 for broader documentation. It would be hugely helpful.