@@ -227,14 +227,17 @@ function RemoteFunctions(config) {
227227 */
228228 function _handleDeleteOptionClick ( event , element ) {
229229 const tagId = element . getAttribute ( "data-brackets-id" ) ;
230- if ( tagId ) {
230+
231+ if ( tagId && element . tagName !== "BODY" && element . tagName !== "HTML" ) {
231232 window . _Brackets_MessageBroker . send ( {
232233 livePreviewEditEnabled : true ,
233234 element : element ,
234235 event : event ,
235236 tagId : Number ( tagId ) ,
236237 delete : true
237238 } ) ;
239+ } else {
240+ console . error ( "The TagID might be unavailable or the element tag is directly body or html" ) ;
238241 }
239242 }
240243
@@ -245,14 +248,17 @@ function RemoteFunctions(config) {
245248 */
246249 function _handleDuplicateOptionClick ( event , element ) {
247250 const tagId = element . getAttribute ( "data-brackets-id" ) ;
248- if ( tagId ) {
251+
252+ if ( tagId && element . tagName !== "BODY" && element . tagName !== "HTML" ) {
249253 window . _Brackets_MessageBroker . send ( {
250254 livePreviewEditEnabled : true ,
251255 element : element ,
252256 event : event ,
253257 tagId : Number ( tagId ) ,
254258 duplicate : true
255259 } ) ;
260+ } else {
261+ console . error ( "The TagID might be unavailable or the element tag is directly body or html" ) ;
256262 }
257263 }
258264
@@ -280,6 +286,8 @@ function RemoteFunctions(config) {
280286 parentElement . hasAttribute ( "data-brackets-id" )
281287 ) {
282288 parentElement . click ( ) ;
289+ } else {
290+ console . error ( "The TagID might be unavailable or the parent element tag is directly body or html" ) ;
283291 }
284292 }
285293
@@ -1033,8 +1041,13 @@ function RemoteFunctions(config) {
10331041 */
10341042 function onClick ( event ) {
10351043 // make sure that the feature is enabled and also the clicked element has the attribute 'data-brackets-id'
1036- if ( isFlagActive && event . target . hasAttribute ( 'data-brackets-id' ) ) {
1037- if ( _nodeMoreOptionsBox ) {
1044+ if (
1045+ isFlagActive &&
1046+ event . target . hasAttribute ( "data-brackets-id" ) &&
1047+ event . target . tagName !== "BODY" &&
1048+ event . target . tagName !== "HTML"
1049+ ) {
1050+ if ( _nodeMoreOptionsBox ) {
10381051 _nodeMoreOptionsBox . remove ( ) ;
10391052 _nodeMoreOptionsBox = null ;
10401053 }
0 commit comments