dojo / dojox

Dojo 1 - extras library. Please submit bugs to https://bugs.dojotoolkit.org/
https://dojotoolkit.org/
Other
150 stars 231 forks source link

DOMException: Failed to execute 'querySelectorAll' on 'Element': '[id='__dojo__'] [dijitDateValue=1532617918647]' is not a valid selector. #284

Closed luiscla27 closed 10 months ago

luiscla27 commented 5 years ago

Hello,

It seems that the selectorEngine "lite" isn't well implementated at "dojox/widget/MultiSelectCalendar", currently you have the following code with the uncompatibility:

`

    _setCurrentFocusAttr: function(/*Date*/ date, /*Boolean*/ forceFocus){
        // summary:
        //      If the calendar currently has focus, then focuses specified date,
        //      changing the currently displayed month/year if necessary.
        //      If the calendar doesn't have focus, updates currently
        //      displayed month/year, and sets the cell that will get focus.
        // forceFocus:
        //      If true, will focus() the cell even if calendar itself doesn't have focus

        var oldFocus = this.currentFocus,
            oldCell = oldFocus ? dojo.query("[dijitDateValue=" + oldFocus.valueOf() + "]", this.domNode)[0] : null;

        // round specified value to nearest day (1am to avoid issues when DST shift occurs at midnight, see #8521, #9366)
        date = new this.dateClassObj(date);
        date.setHours(1, 0, 0, 0);

        this._set("currentFocus", date);
        var currentMonth = stamp.toISOString(date).substring(0,7);
        //We only redraw the grid if we're in a new month
        if(currentMonth != this.previousMonth){
            this._populateGrid();
            this.previousMonth = currentMonth;
        }

        // set tabIndex=0 on new cell, and focus it (but only if Calendar itself is focused)
        var newCell = dojo.query("[dijitDateValue='" + date.valueOf() + "']", this.domNode)[0];
        newCell.setAttribute("tabIndex", this.tabIndex);
        if(this._focused || forceFocus){
            newCell.focus();
        }

        // set tabIndex=-1 on old focusable cell
        if(oldCell && oldCell != newCell){
            if(dojo.isWebKit){  // see #11064 about webkit bug
                oldCell.setAttribute("tabIndex", "-1");
            }else{
                    oldCell.removeAttribute("tabIndex");
            }
        }
    },

` I think you need to change the "oldCell" query to:

oldCell = oldFocus ? dojo.query("[dijitDateValue='" + oldFocus.valueOf() + "']", this.domNode)[0] : null;

luiscla27 commented 5 years ago

I'll make a pull request fixing this as soon as someone here accept this is an actual issue... thanks.

wkeese commented 5 years ago

Makes sense, that's already how the other dojo.query() call in that method works. (It's curious that you don't need quotes for [foo=bar] but you do need them for [foo=123], but I confirm that it's true by testing document.querySelectorAll() on Chrome.

luiscla27 commented 10 months ago

This was a Google Chrome bug, they fixed it pretty fast, so there was no reason to make a PR.