Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#15229 closed enhancement (fixed)

missing doc parameter to various DOM functions

Reported by: bill Owned by: bill
Priority: undecided Milestone: 1.8
Component: HTML Version: 1.7.2
Keywords: Cc: Eugene Lazutkin
Blocked By: Blocking:

Description (last modified by bill)

Besides the domConstruct.create() issue I listed in #15226, there are a number of functions that should probably take an optional doc parameter in the same way that dom.byId(id, doc) and domConstruct.toDom(string, doc) do:

dojo/_base/window.js:

  • body() (actually, I just fixed this in [28401])

dojo/window.js:

  • getBox() (could arguably pass in a window instead of a document, but document is more convenient)

dojo/dom-geometry.js:

  • isBodyLtr()
  • docScroll()
  • getIeDocumentElementOffset()
  • fixIeBiDiScrollLeft()

Suggestions taken from Sudoh-san's spreadsheet

Change History (4)

comment:1 Changed 7 years ago by bill

Cc: Eugene Lazutkin added
Description: modified (diff)
Milestone: tbd1.8
Owner: changed from Eugene Lazutkin to bill
Status: newassigned

It looks like the missing doc parameters were just oversights, rather than design decisions, so I'll check in a fix. Let me know if the parameter was intentionally omitted.

comment:2 Changed 7 years ago by bill

Resolution: fixed
Status: assignedclosed

In [28405]:

Add missing (optional) document parameter for various DOM methods, and update code (mainly dijit code) to pass in the document to those methods, fixes #15229 !strict.

comment:3 Changed 7 years ago by Eugene Lazutkin

Was withDoc() not enough?

comment:4 Changed 7 years ago by bill

Type: defectenhancement

It's possible to control the document used by these methods via withDoc() or withGlobal().

However, out of all the dom* and window methods, these were the only ones where using withDoc() was necessary. byId() and toDom() take a document parameter, so I followed that precedent. Many other methods infer the document from a DOMNode parameter, but that wasn't possible for the above methods.

Besides the consistency issue, passing a document parameter to these methods is faster and less code than using withDoc().

Last edited 7 years ago by bill (previous) (diff)
Note: See TracTickets for help on using tickets.