blob: 1784afb1d0a656b762d0d84a51b4e7bab38f5c36 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script type="data:text/html">
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 14">
<link id=Main-File rel=Main-File href="dummy_path">
<link rel=File-List href="dummy_path2">
<base href="dummy-base">
<title>Dummy Title</title>
<style>
<!--table
{mso-displayed-decimal-separator:"\.";
mso-displayed-thousand-separator:"\,";}
@page
{margin:1.0in .75in 1.0in .75in;
mso-header-margin:.5in;
mso-footer-margin:.5in;}
td
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:Calibri, sans-serif;
mso-font-charset:0;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
border:none;
mso-background-source:auto;
mso-pattern:auto;
mso-protection:locked visible;
white-space:nowrap;
mso-rotate:0;}
-->
</style>
</head>
<body link=blue vlink=purple>
<table border=0 cellpadding=0 cellspacing=0 width=130 style='border-collapse:
collapse;width:130pt'>
<!--StartFragment-->
<col width=65 span=2 style='width:65pt'>
<tr height=15 style='height:15.0pt'>
<td height=15 width=65 style='height:15.0pt;width:65pt'>hello</td>
<td width=65 style='width:65pt'>world</td>
</tr>
<tr height=15 style='height:15.0pt'>
<td height=15 style='height:15.0pt'></td>
<td>webkit</td>
</tr>
<!--EndFragment-->
</table>
</body>
</html>
</script>
<p>This test ensures WebKit strips away base, link, meta, style and title elements before inserting HTML.</p>
<div id="test" contenteditable></div>
<pre><script type="text/javascript">
var htmlInPasteboard = document.getElementsByTagName('script')[0].firstChild.textContent;
document.getElementById('test').focus();
document.execCommand('InsertHTML', false, htmlInPasteboard);
var passed = true;
function expectElementCount(test, selector) {
let actual = document.body.querySelectorAll(selector).length;
if (test(actual))
return;
document.write('FAIL - found ' + actual + ' ');
document.write(actual == 1 ? 'instance' : 'instances');
document.writeln(' of ' + selector);
passed = false;
}
function expectNoInstanceOf(elementName) {
expectElementCount((x) => x == 0, elementName);
}
function expectInstancesOf(elementName) {
expectElementCount((x) => x > 0, elementName);
}
if (window.testRunner)
testRunner.dumpAsText();
expectNoInstanceOf('base');
expectNoInstanceOf('meta');
expectNoInstanceOf('link');
expectNoInstanceOf('style');
expectNoInstanceOf('title');
if (passed)
document.writeln('PASS');
document.getElementById('test').innerHTML = '';
</script></pre>
</body>
</html>