Skip to content

Making it work with Internet Explorer. #13

@lugui20

Description

@lugui20

Here is how to deal with Internet Explorer:

1 . SCRIPT5007: Object.getPrototypeOf: 'this' is not an Object

Instead of 'input[name="date_field"]' use DOM element selector:

instance = new dtsel.DTS(document.getElementById("date_field"),  { // or document.getElementsByName("date_field")[0]
    direction: 'BOTTOM',
    dateFormat: "yyyy-mm-dd",
    showTime: false,
    timeFormat: "HH:MM:SS"
});

2. SCRIPT1014: Invalid character.

It doens't accept the character "`" on the lines 275, 277 and 280 Alternatively, rewrite those lines as shown:

 self.el.wrapper.style.left = left + "px";
 if (box.top > minTopSpace && config.direction != "BOTTOM") {
    self.el.wrapper.style.bottom = bottom + "px";
    self.el.wrapper.style.top = "";
 } else {
    self.el.wrapper.style.top = top + "px";
     self.el.wrapper.style.bottom = ''; 
}

3. SCRIPT438: Object doesn't support property or method 'assign'

The following "polyfill" is needed: Polyfill for assign() method . More info here
(Just add the code before dtsel.js).

//////////////////////////////////////////
// Polyfill
//////////////////////////////////////////

if (typeof Object.assign != 'function') {
  Object.assign = function(target) {
    'use strict';
    if (target == null) {
      throw new TypeError('Cannot convert undefined or null to object');
    }

    target = Object(target);
    for (var index = 1; index < arguments.length; index++) {
      var source = arguments[index];
      if (source != null) {
        for (var key in source) {
          if (Object.prototype.hasOwnProperty.call(source, key)) {
            target[key] = source[key];
          }
        }
      }
    }
    return target;
  };
}

4. Formatting problems:

To fix several fomatting bugs you must split the commands to add and remove CSS classes into multiple lines, because aparently IE only considers the first parameter. So, for example, instead of
cell.classList.remove(classes[0], classes[1], classes[2]);
you need to write:

cell.classList.remove(classes[0]);
cell.classList.remove(classes[1]);
cell.classList.remove(classes[2]);

or instead of
cell.classList.add("cal-nav", classes[i]);
you need to write

cell.classList.add("cal-nav");
cell.classList.add(classes[i]);

etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions