1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
---|
2 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru"> |
---|
4 | <head> |
---|
5 | <title>Test innerHTML</title> |
---|
6 | <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> |
---|
7 | <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> |
---|
8 | <script type="text/javascript" src="http://neil.fraser.name/software/diff_match_patch/svn/trunk/javascript/diff_match_patch.js"></script> |
---|
9 | <script> |
---|
10 | $( function () |
---|
11 | { |
---|
12 | var dmp = new diff_match_patch(); |
---|
13 | dmp.Diff_Timeout = 5; |
---|
14 | dmp.Diff_EditCost = 4; |
---|
15 | var source = $( '#source').val(), |
---|
16 | output = $( '<div>' ).html( source ).html(); |
---|
17 | |
---|
18 | var d = dmp.diff_main( source, output.toLowerCase() ); |
---|
19 | var ds = dmp.diff_prettyHtml( d ); |
---|
20 | |
---|
21 | $( '#source' ).replaceWith( ds ); |
---|
22 | } ) |
---|
23 | </script> |
---|
24 | </head> |
---|
25 | <body> |
---|
26 | <h3>Difference between I/O of the 'innerHTML' attribute</h3> |
---|
27 | <textarea id="source"><hr /><div><p>in div <span>in span</span></p></div><ul><li>bullet1<ol><li>item1</li></ol></li></ul><pre> |
---|
28 | line1 |
---|
29 | line2 |
---|
30 | </pre></textarea></body> |
---|
31 | </html> |
---|
32 | |
---|
33 | |
---|