source: Dev/trunk/src/client/dijit/_base/popup.js @ 529

Last change on this file since 529 was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 1.8 KB
Line 
1define([
2        "dojo/dom-class", // domClass.contains
3        "dojo/_base/window",
4        "../popup",
5        "../BackgroundIframe"   // just loading for back-compat, in case client code is referencing it
6], function(domClass, win, popup){
7
8// module:
9//              dijit/_base/popup
10
11/*=====
12return {
13        // summary:
14        //              Deprecated.   Old module for popups, new code should use dijit/popup directly.
15};
16=====*/
17
18
19// Hack support for old API passing in node instead of a widget (to various methods)
20var origCreateWrapper = popup._createWrapper;
21popup._createWrapper = function(widget){
22        if(!widget.declaredClass){
23                // make fake widget to pass to new API
24                widget = {
25                        _popupWrapper: (widget.parentNode && domClass.contains(widget.parentNode, "dijitPopup")) ?
26                                widget.parentNode : null,
27                        domNode: widget,
28                        destroy: function(){},
29                        ownerDocument: widget.ownerDocument,
30                        ownerDocumentBody: win.body(widget.ownerDocument)
31                };
32        }
33        return origCreateWrapper.call(this, widget);
34};
35
36// Support old format of orient parameter
37var origOpen = popup.open;
38popup.open = function(/*__OpenArgs*/ args){
39        // Convert old hash structure (ex: {"BL": "TL", ...}) of orient to format compatible w/new popup.open() API.
40        // Don't do conversion for:
41        //              - null parameter (that means to use the default positioning)
42        //              - "R" or "L" strings used to indicate positioning for context menus (when there is no around node)
43        //              - new format, ex: ["below", "above"]
44        //              - return value from deprecated dijit.getPopupAroundAlignment() method,
45        //                      ex: ["below", "above"]
46        if(args.orient && typeof args.orient != "string" && !("length" in args.orient)){
47                var ary = [];
48                for(var key in args.orient){
49                        ary.push({aroundCorner: key, corner: args.orient[key]});
50                }
51                args.orient = ary;
52        }
53
54        return origOpen.call(this, args);
55};
56
57return popup;
58});
Note: See TracBrowser for help on using the repository browser.