javascript - Revert getElementsByClassName to original browser version -


i'm working on existing web page has sorts of javascript i'm not able edit. have access part of page stuff. problem using jquery. previous developer had modified getelementsbyclassname method custom version, i'm assuming kind of polyfill ie. breaks jquery uses getelementsbyclassname on supported browsers.

now how may revert getelementsbyclassname original version before code executed. can't find original method anywhere online. not using jquery not option i'm trying integrate big piece of code written jquery.

thanks.

since prototype chain of document wasn't altered, restore deleting current implementation, mentioned in comments:

delete document.getelementsbyclassname; 

demo

that make implementation available again via prototype chain.

old answer

you try restore hack:

document.getelementsbyclassname = document.documentelement.getelementsbyclassname     .bind(document.documentelement); 

i'm not whether has downsides, though.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -