              options.widget.map.addInteraction(options.widget.interactions.draw);
              var className = options.widget.currentGeometryType.element.className.replace(/ type-active/g, '');
              options.widget.currentGeometryType.element.className = className;
              options.widget.currentGeometryType = self;
              element.className += " type-active";
          }
      };
  
      element.addEventListener('click', switchType, false);
      element.addEventListener('touchstart', switchType, false);
 
</s> remove             var className = options.widget.currentGeometryType.element.className.replace(/ type-active/g, '');
            options.widget.currentGeometryType.element.className = className;
 </s> add             options.widget.currentGeometryType.element.classList.remove('type-active'); </s> remove         element.className += " type-active";
 </s> add         element.classList.add("type-active"); </s> remove                 if (elem.className.indexOf('active') !== -1) {
 </s> add                 if (elem.classList.contains('active')) { </s> remove         if (elem.className.indexOf('vManyToManyRawIdAdminField') !== -1 && elem.value) {
 </s> add         if (elem.classList.contains('vManyToManyRawIdAdminField') && elem.value) { </s> remove                 if (elem.className.indexOf('vManyToManyRawIdAdminField') !== -1 && elem.value) {
 </s> add                 if (elem.classList.contains('vManyToManyRawIdAdminField') && elem.value) {
            element.classList.add("type-active");
              options.widget.map.addInteraction(options.widget.interactions.draw);
              var className = options.widget.currentGeometryType.element.className.replace(/ type-active/g, '');
              options.widget.currentGeometryType.element.className = className;
              options.widget.currentGeometryType = self;
            element.classList.add("type-active");
          }
      };
  
      element.addEventListener('click', switchType, false);
      element.addEventListener('touchstart', switchType, false);
keep keep keep keep replace keep keep keep keep keep
 Fixed #31028 -- Used classList API to check, add and remove DOM classes.

Thanks to Claude Paroz for review. 
django/contrib/gis/static/gis/js/OLMapWidget.js