Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / Range / surroundContents-for-detached-node.html
blob0c45c2da84c5d3d31374877fa5f84d18441d5c21
1 <div id="container">
2 <p id="description"></p>
3 <div id="sample">0123456789</div>
4 </div>
5 <div id="console"></div>
6 <script src="../../../resources/js-test.js"></script>
7 <script>
8 description('Range.surroundContents() should not throw exception for detached node.');
9 function $(id) { return document.getElementById(id); }
11 function surroundContents(node) {
12 var range = document.createRange();
13 range.setStart(node.firstChild, 2);
14 range.setEnd(node.firstChild, 6);
15 var newNode = document.createElement('b');
16 range.surroundContents(newNode);
17 return newNode.outerHTML;
20 var sample = $('sample');
21 var expected = '<b>' + sample.firstChild.textContent.substring(2, 6) + '</b>';
22 shouldBeEqualToString('surroundContents(sample.cloneNode(true))', expected);
23 sample.parentNode.removeChild(sample);
24 shouldBeEqualToString('surroundContents(sample)', expected);
26 if (window.testRunner)
27 $('container').outerHTML = '';
28 </script>