I was trying to parse a site which implemented its own version of hasOwnProperty. However, the native implementation is what was getting picked up.
To validate this out I tried parsing a simple html as follows
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>test</title>
</head>
<body>
<p>I would like to say: </p>
<script>
function hasOwnProperty(){
try {
$('body').append('<div>success</div>');
}catch(e){
$('body').append('<div>'+e+'</div>');
}
}
try {
hasOwnProperty();
$('body').append('<div>Success2</div>');
}catch(e){
$('body').append('<div class="two">'+e+'</div>');
}
</script>
</body>
</html>
I get an error "TypeError: Cannot convert null to object" which tells me the native implementation is being called
When I change the name of the function though, my function is executed.
Is this a known issue? How do I handle this?