S
S
Sergey Alpeev2014-09-22 10:40:53
JavaScript
Sergey Alpeev, 2014-09-22 10:40:53

Why doesn't DOMSubtreeModified work correctly in firefox??

Good day, I have a code

$(mSearch2.options.results).on("DOMSubtreeModified", function() {
                                 //* перезагрузка результатов 
                            
                                  myMap.geoObjects.remove(clusterer); 
                                   var new_object = ymaps.geoQuery([]); 
                                  var massive_coord = $(".coords"); 
                                      massive_coord.each(function(i){
                                        new_object = new_object.add(ymaps.geoQuery(ymaps.geocode($(this).text(),{results: 1}))
                                        
                                         .setProperties({
                                            balloonContentHeader:$(this).data('title'),
                                            balloonContentBody: $(this).data('description')
                                         })
                                    
                                    );
                                    
                                     new_object.setOptions({
                                        iconLayout: 'default#image',
                                        iconImageHref: 'main/red_marker.png',
                                        iconImageSize: [20, 35],
                                        iconImageOffset: [-3, -42]
                                        
                                 })
                                 
                                 
                             
                                      var clus = new_object.clusterize();
                                      myMap.geoObjects.add(clus); 
                                      
                                        
                                  });
                                 
                            
                            });

which works correctly in chrome, it should work immediately after the filter form has completed, after that an array of addresses is collected and marks are drawn on the map, in firefox the marks for some reason just blink and that's it

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Melnikov, 2014-09-22
@mlnkv

To begin with, learn how to insert the code normally, so that your eyes do not climb on your forehead. Regarding the DOMSubtreeModified event - although it is deprecated, it still works fine in the latest version of FF

$(mSearch2.options.results).on("DOMSubtreeModified", function() {
  //* перезагрузка результатов  
  var new_object = ymaps.geoQuery([]); 
  var massive_coord = $(".coords"); 

  myMap.geoObjects.remove(clusterer); 
  massive_coord.each(function(i) {
    new_object = new_object
      .add(
        ymaps.geoQuery(
          ymaps.geocode($(this).text(), { results: 1}))
          .setProperties({
            balloonContentHeader:$(this).data('title'),
            balloonContentBody: $(this).data('description')
          });
      );
    
    new_object.setOptions({
      iconLayout: 'default#image',
      iconImageHref: 'main/red_marker.png',
      iconImageSize: [20, 35],
      iconImageOffset: [-3, -42]
    }); 

    var clus = new_object.clusterize();
    myMap.geoObjects.add(clus);
  });

});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question