<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
window.onload=function(){
var div = document.querySelectorAll('p[foo="bar"]')[0];
console.log(div.innerHTML)
}
</script>
</head>
<body>
<p foo="bar">Lorem Ipsum color dot....</p>
</body>
</html>