JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.3
[ckeditor.git] / _samples / divreplace.html
index 35699e2..9985fe2 100644 (file)
@@ -1,6 +1,6 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
 <!--\r
-Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 -->\r
 <html xmlns="http://www.w3.org/1999/xhtml">\r
@@ -48,10 +48,15 @@ function onDoubleClick( ev )
        var element = ev.target || ev.srcElement;\r
 \r
        // Find out the div that holds this element.\r
-       element = element.parentNode;\r
+       var name;\r
+       do\r
+       {\r
+               element = element.parentNode;\r
+       }\r
+       while ( element && ( name = element.nodeName.toLowerCase() ) && ( name != 'div' || element.className.indexOf( 'editable' ) == -1 ) && name != 'body' )\r
 \r
-       if ( element.nodeName.toLowerCase() == 'div'\r
-                && ( element.className.indexOf( 'editable' ) != -1 ) )\r
+\r
+       if ( name == 'div' && element.className.indexOf( 'editable' ) != -1 )\r
                replaceDiv( element );\r
 }\r
 \r
@@ -141,7 +146,7 @@ function replaceDiv( div )
                        CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>\r
                </p>\r
                <p id="copy">\r
-                       Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico\r
+                       Copyright &copy; 2003-2012, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico\r
                        Knabben. All rights reserved.\r
                </p>\r
        </div>\r