@@ -128,8 +128,8 @@ function RemoteFunctions(config = {}) {
128128
129129 if ( element && // element should exist
130130 element . hasAttribute ( "data-brackets-id" ) && // should have the data-brackets-id attribute
131- element . tagName !== "BODY " && // shouldn't be the body tag
132- element . tagName !== "HTML " && // shouldn't be the HTML tag
131+ element . tagName . toLowerCase ( ) !== "body " && // shouldn't be the body tag
132+ element . tagName . toLowerCase ( ) !== "html " && // shouldn't be the HTML tag
133133 ! _isInsideHeadTag ( element ) ) { // shouldn't be inside the head tag like meta tags and all
134134 return true ;
135135 }
@@ -142,9 +142,22 @@ function RemoteFunctions(config = {}) {
142142 function _isInsideHeadTag ( element ) {
143143 let parent = element ;
144144 while ( parent && parent !== window . document ) {
145- if ( parent . tagName === "HEAD " ) {
145+ if ( parent . tagName . toLowerCase ( ) === "head " ) {
146146 // allow <style> tags inside <head>
147- return element . tagName !== "STYLE" ;
147+ return element . tagName . toLowerCase ( ) !== "style" ;
148+ }
149+ parent = parent . parentElement ;
150+ }
151+ return false ;
152+ }
153+
154+ // helper function to check if an element is inside an SVG tag
155+ // we need this because SVG elements don't support contenteditable
156+ function _isInsideSVGTag ( element ) {
157+ let parent = element ;
158+ while ( parent && parent !== window . document ) {
159+ if ( parent . tagName . toLowerCase ( ) === "svg" ) {
160+ return true ;
148161 }
149162 parent = parent . parentElement ;
150163 }
@@ -1114,7 +1127,7 @@ function RemoteFunctions(config = {}) {
11141127 "textarea"
11151128 ] ;
11161129
1117- if ( voidElements . includes ( tagName ) || nonEditableElements . includes ( tagName ) ) {
1130+ if ( voidElements . includes ( tagName ) || nonEditableElements . includes ( tagName ) || _isInsideSVGTag ( element ) ) {
11181131 return false ;
11191132 }
11201133
@@ -1154,8 +1167,8 @@ function RemoteFunctions(config = {}) {
11541167 _registerDragDrop : function ( ) {
11551168 // disable dragging on all elements and then enable it on the current element
11561169 const allElements = document . querySelectorAll ( '[data-brackets-id]' ) ;
1157- allElements . forEach ( el => el . setAttribute ( "draggable" , false ) ) ;
1158- this . element . setAttribute ( "draggable" , true ) ;
1170+ allElements . forEach ( el => el . setAttribute ( "draggable" , " false" ) ) ;
1171+ this . element . setAttribute ( "draggable" , " true" ) ;
11591172
11601173 this . element . addEventListener ( "dragstart" , ( event ) => {
11611174 event . stopPropagation ( ) ;
0 commit comments