I have put the scripts in their respective places but for some reason it doesn't work. I loaded the demo in Safari 5.0 for windows and it worked, I don't know what I'm doing wrong. The script files are in the same directory as index.html. Any help would be really appreciated :)
Please forgive me if it's a stupid question put it's the first time that i'm implementing a polyfill.
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="test"></div>
<script type="text/javascript">
if (!Array.prototype.filter)
{
Array.prototype.filter = function(fun /*, thisp*/)
{
var len = this.length;
if (typeof fun != "function")
throw new TypeError();
var res = new Array();
var thisp = arguments[1];
for (var i = 0; i < len; i++)
{
if (i in this)
{
var val = this[i]; // in case fun mutates this
if (fun.call(thisp, val, i, this))
res.push(val);
}
}
return res;
};
}
</script>
<script src="tokenizer.js"></script>
<script src="parser.js"></script>
<script src="vminpoly.js"></script>
</body>
</html>
#test {
width: 10vw;
height: 10vh;
background-color: red;
}
I have put the scripts in their respective places but for some reason it doesn't work. I loaded the demo in Safari 5.0 for windows and it worked, I don't know what I'm doing wrong. The script files are in the same directory as index.html. Any help would be really appreciated :)
Please forgive me if it's a stupid question put it's the first time that i'm implementing a polyfill.