Giter Site home page Giter Site logo

dojo / dojo Goto Github PK

View Code? Open in Web Editor NEW
1.5K 158.0 540.0 11.28 MB

Dojo 1 - the Dojo 1 toolkit core library.

Home Page: https://dojotoolkit.org/

License: Other

JavaScript 94.35% CSS 0.10% HTML 5.04% Shell 0.01% PHP 0.49% Batchfile 0.01% Roff 0.01%
dojo-toolkit javascript

dojo's People

Contributors

blowery avatar bryanforbes avatar ccmitchellusa avatar cjolif avatar clmath avatar csnover avatar dylans avatar evanhw avatar jrburke avatar kfranqueiro avatar kitsonk avatar kriszyp avatar ktiedt avatar liucougar avatar msssk avatar neonstalwart avatar nicknisi avatar nicrizzo avatar novemberborn avatar peller avatar phiggins42 avatar pottedmeat avatar rcgill avatar sfoster avatar slightlyoff avatar toonetown avatar ttrenka avatar uhop avatar vansimke avatar wkeese avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dojo's Issues

The change of how .dijitHidden is implemented in 1.11 from display:none to visibility: hidden is causing issues in our tab containers.

We've just upgraded to Dojo 1.14 from 1.10 for our 50+ apps and are doing regression testing. Pretty quickly a number of folks have noticed some issues, especially a few apps using tab containers... Specifically we have seen tab containers shifted by a noticeable amount as well as scrollbars appearing that didn't appear previously.

In my app I noticed that the issue stemmed from .dijitHidden being changed from "display: none;" to "visibility: hidden;" ... seems like a pretty glaring difference given the differences in sizing that the two have.

Trac issue #18967 (https://bugs.dojotoolkit.org/ticket/18967#comment:3) appears related but diverges to some geometry changes instead of this .djijtHidden change.

We are working on gathering more details from our various apps as some have not shown problems. Our apps are intranet (and therefore not viable for demonstrating the issue) and I do not have a test app yet to demonstrate the issue.

[xhr] Can't register custom handlers for binary content

Hi,

The following ticket https://bugs.dojotoolkit.org/ticket/16893, introduced some new handlers values 'blob', 'document', and 'arraybuffer' to handle binary data directly.

Unfortunatelly it is not possible to register custom handlers for XHR requests returning binary responses.

As a concrete use case, i need to get blob data AND some HTTP headers from the response.

The only way i found is to overwrite the 'blob' handler:

    handlers.register('blob', function(response){

        var data;

        if(!has('native-xhr2-blob') 
            && response.options.handleAs === 'blob' 
            && typeof Blob !== 'undefined'){
            data = new Blob([ response.xhr.response ], 
                {type: response.xhr.getResponseHeader('Content-Type')});
        } else {
            data = response.xhr.response;
        }
        return {
            headers: response.xhr.getAllResponseHeaders(),
            data: data
        }
    });

which is hackish because once used (one shot use case), i don't think it is possible to revert back to original handler.

I think the issue is because of binary handlers names are hardcoded into an internal nativeResponseTypes array into dojo/request/xhr.js which is then used to set XMLHttpRequest.responseType.

There should be a way to declare a custom handler for binary content.

ES6/2017 in Dojo 1.x

I wanted to drop a message here for people looking for ES6/2017 feature support in Dojo. It was supposed to be added in 1.12, but didn't work correctly. That's why i have been working on a workaround. Below is a copy of what i put on stackoverflow.com.

Since development on Dojo 1.x seems to have stalled and easy migration to Dojo 2.x is not available, we had to come up with a solution to this. It was getting ridiculous that we as developers are stuck on ES5 features, only because the build process cannot handle it.

That's why i came up with a workaround, which as of now is in test in our company. For the ones interested, this is how we work around this issue (and still use the core part of the dojo build process):

  • disable optimization in the build profile (layerOptimize: false, optimize: false)

  • mark all widgets as non-AMD in package.js (amd: function(){ return false;})
    this causes all widgets to get a warning in the build, but no failure

  • after the build process is done, all "layers" files are complete (including ES6 features possibly), but not minified, and thus very big in size.

  • in maven (or your build tool of choice), run any minifier that works for you.

  • we use the latest Closure compiler with the following settings, which will transpile ES2017 code into ES5.

<plugin>
<groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-antrun-plugin</artifactId>
 <executions>
   <execution>
     <exec executable="java" resolveexecutable="true" failonerror="true">
       <arg value="-jar" />
       <arg value="${google.closure.compiler.es2017}" />
       <arg value="--language_in=ECMASCRIPT_2017" />
       <arg value="--language_out=STABLE" />
       <arg value="--js" />
       <arg value="${dojo.build.path}/build/layers/OriginalLayer.js" />
       <arg value="--js_output_file" />
       <arg value="${dojo.build.path}/build/layers/MinifiedLayer.js" />
     </exec>
   </execution>
 </executions>
</plugin>

This is still experimental, but first results look good and seem to work without regression.

Let me know if you have thoughts or comments on this. I know it's not the ideal solution, but i wasn't up for changing the build tool itself. This workaround makes newer JS features an option, which makes Dojo 1.x a bit more developer friendly for those stuck on this major version.

Add `finally` method to dojo/Deferred

Background info

The .finally method has landed in ES2018 promises:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/finally

It's extremely helpful in that it provides a robust way to emulate the behavior of the construct

try {
    return runSomething();
} finally {
    cleanup();
}

in Deferreds/Promises. The promises way to build this is (assuming runSomething returns a promise that resolves to the result value):

return runSomething().finally(cleanup);

By contrast, .always is not appropriate for "run this cleanup code no matter what" scenarios. The statement return runSomething().always(cleanup); is more equivalent to:

var result, error;
try {
    result = runSomething();
} catch(e) {
    error = e;
}
return cleanup(error||result);

Problems with .always:

  • caught error doesn't bubble upwards (unless cleanup throws any passed error, but we can't know whether the error was merely returned or whether it was thrown)
  • original result not returned unless cleanup does that explicitly
  • cleanup code shouldn't have to care about result/error - irrelevant

Question/issue

I have a PR in progress (not submitted yet) to add finally to dojo/Deferred.

The problem is that the finally keyword was reserved prior to ES5, thus the default ES3 dojo compilation (using Closure Compiler) will error out if we use finally as an identifier or object key literal.

I see two potential alternatives:

  1. Implement using strings instead of object key literals. In this case, the implementation in Deferred.js could simply use:

    this["finally"] = promise["finally"] = function(callback){
    

    Also, any users still subject to ES3 restrictions in their build would have to use something like promise["finally"](function() { /* cleanup */ });. Although if they're using something more recent, this would not be required (perhaps I could also add updated Closure Compiler settings or an UglifyJS build plugin in the PR).

  2. Use a different name. Users who want to write code that operates on both native ES2018 promises and Dojo promises would have to come up with a solution of their own -- perhaps adding an alias like:

    Promise.prototype.ourNewFinallyName = Promise.prototype.finally;
    

    The downside is that this would break potential compatibility with third party libraries that use promise.finally(...).

Personally, I'm leaning towards (1).


Update: PR submitted (implements option (1)): #352

Elect / Nominate representative(s) to the OpenJS Foundation CPC

Context

As part of the new OpenJS Foundation's bylaws, the Cross Project Council (CPC) has been chartered to serve as the primary governing body for programs and regular support of Foundation projects. For example, it will be responsible for things like infrastructure, travel assistance, CoC support, accepting new projects into the foundation, and mentorship programs to name a few. It will also be responsible for electing board representative(s) to the OpenJS Foundation board of directors.

Any interested person from our project communities can attend CPC meetings and volunteer to participate in tasks. For most programs, the CPC is expected to operate on the consensus of OpenJS Foundation project members. Issues that require a vote - namely the election of Board representatives and accepting a new project - will be memorialized by a voting CPC membership comprised of up to 2 representatives from Impact level projects and 2 representatives from Growth and At-Large stages.

If you'd like more info/context on the governance of the OpenJS Foundation, please let me know or follow this repo. The main point I hope you take away is that the foundation is to be run by and for the projects, and to do that we need participants from the project community.

Request

As an Impact level project, Dojo is expected to send up to two formal representatives to participate in CPC meetings in a voting capacity. We (the bootstrap CPC group) would like you to make this selection by May 1. You can do that in whatever fashion you would like (projects retain their own internal governance).

We anticipate having our first 'official' CPC meeting on May 30 or 31 at the Collaborator Summit in Berlin (sidebar, you should come!). In the interim, we would love for Dojo project members to participate in the Bootstrap CPC meetings which are currently held on Mondays (watch this repo for meeting details).

If this is not the correct forum to raise this, please let me know and I will close the issue and post it in the preferred channel. Note that I'm posting essentially the same message to all OpenJS Foundation project repos, because I want to get the word out and make sure we all have the same information.

your pal,
Jory

dojotoolkit.org is down

Hi!

dojotoolkit.org is down and new dojo.io doesn't contain documentation for Dojo 1. Where to look old documentation?

A question about the ' isAlien ' function from dojo/_base/lang.

version: 1.13.0

isAlien: function(it){
			// summary:
			//		Returns true if it is a built-in function or some other kind of
			//		oddball that *should* report as a function but doesn't
			return it && !lang.isFunction(it) && /\{\s*\[native code\]\s*\}/.test(String(it)); // Boolean
		}

   Here you said that this function return true if it is a built-in function or some other kind of oddball that should report as a function but doesn't, when it was used. But when I use it to test some built-in function such as Function, Array, Promise,all of them return false. I don‘t know why. After a period of thinking,I found something wrong with the code ' !lang.isFunction(it) ', is it one more or one less " ! " in this code?Please tell me, thank you.:yum:

Handling DELETE calls as json in JsonRest store.

Hi dojo team and thanks for creating this feature rich library.

I saw a little something while using the JsonRest store that could probably be aligned easily:

Query, Add, Put & Get calls all use xhr calls that have the option handleAs: "json" set.
But DELETE does not handle the response as json. Which causes the behavior to differ from expectation.

So, please tell me, is that wanted or is it just by mistake?

Do you consider adding the handling for DELETE calls as json like all other calls a valid Pull Request?
If so, I would be happy to contribute by creating one.

Dojo 1.13.1 breaks FormData submission (from 1.13.0)

In ledgersmb/LedgerSMB#3799 a problem is being reported due to our project upgrading the included (built) Dojo from 1.13.0 to 1.13.1. The problem lies in code which - when flattened and stripped - looks like this:

                     options["data"] = new FormData(this.domNode);
                     // FF doesn't add the clicked button
                    options["data"].append('action',
                                         this.clickedAction);
                      return xhr(url, options).then(
                          function(doc){
                              self.hide_main_div();
                              self.set_main_div(doc);
                          },
                          function(err){
                              self.show_main_div();
                              self.report_request_error(err);
                          });

where xhr is required as dojo/request/xhr.

Instead of posting the content of 'FormData, the actual content being posted is [object Object]`.

DnD eating onMouseDown events breaks dgrid selection

I have a dgrid like OnDemandGrid.createSubclass([ Keyboard, ColumnResizer ]).createSubclass([ Tree, Editor, DnD ])

With DnD enabled, clicking on a cell doesn't move the "keyboard focus" there. Meaning arrow keys jump back to the previous cell selected using the keyboard or by clicking on a form element.

I tracked the issue to this repo, dnd/Selector.js here and here.

It seems the mousedown event doesn't reach some relevant handler in dgrid. The stopPropagation in this repo was apparently intended to stop text selection, but dgrid or its mixins already handle that.

I don't know of any nice way to handle this special case with dgrid without possibly breaking something else. I simply used dojo/aspect to redirect the event's stopPropagation and preventDefault methods to blank functions before reaching onMouseDown in Selector.js. That fixes the problem for my case.

For the record, here's the (TypeScript) code for patching the event:

import * as Source from 'dojo/dnd/Source';

function nop() {}

aspect.before((Source as any).superclass, 'onMouseDown', (e: MouseEvent) => {
	e.stopPropagation = nop;
	e.preventDefault = nop;
	return([ e ]);
});

Regex to remove comments in loader.js

The regex removeCommentRe = /(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg, in loader.js is admitted to being a "very poor technique" in the code, but a perfect solution is dismissed as impossible without parsing the code.

I think it's possible when adapting a technique from here (for removing comments in the C language): https://codegolf.stackexchange.com/a/48332/34718

The simpler version for comments in the C version is to replace //.*|/\*[\s\S]*?\*/|("(\\.|[^"])*") with $1. The trick is to not only try to match comments, but also to match strings. Then you can replace everything with the first group, which will remove comments and keep strings.

I think this might be a complete solution for JavaScript (to replace with $1):

var re = /\/\/.*|\/\*[\s\S]*?\*\/|("(?:\\.|[^"])*"|'(?:\\.|[^'])*'|`(?:\\.|[^`])*`)/g;

It includes single quotes, double quotes, line continuations, escape characters, and template strings.

I tried some test cases using a regex-based language called Retina here.

Try running it against some more complicated test cases if you have some.

scriptError is cryptic

When dojo has issues loading a package it throws a scriptError (https://github.com/dojo/dojo/blob/master/dojo.js#L1764). The URL is passed to the signal, but it isn't displayed anywhere so I'm left wondering where things went wrong.

Proposed solution: add the URL to the first argument so I at least know where to look:

signal(error, makeError("scriptError: " + url, [url, e]));

In IE11, when the x button is clicked (in a text or select control), dojo will not trigger the onchange event as it used to be.

Hello team,

Your help is appreciated.

IBM BPM embeds dojo to support various browsers, including IE 11.

  1. in previous version IBM BPM uses dojo 1.7.4, and in IE 11 when user clicks the x button in a text control to clean the input, the onchange event would be triggered by dojo so IBM BPM can process accordingly.

  2. however in later version IBM BPM uses dojo 1.8.3, so in IE 11 when user clicks the x button in a text control to clean the input, no event is triggered so IBM BPM has no chance to pickup the change and process accordingly.

Would you please help have a look why dojo 1.8.3 has such regression and whether this can be solved in new release?

Please feel free to let me ([email protected]) know whether you need any more information.

Thanks and best regards,

[email protected]
Feb 28, 2018

Parser ignores logic in table elements

When using a widget with a template, elements that are rendered inside of a

element are not parsed properly.

{{batteryList}}
<table>
    <tbody>
        <tr>{{batteryList}}</tr>
    </tbody>
</table>

Will output the following to the dom:

[object Object]
[object Object]
<table style="">
    <tbody style="">
        <tr style=""></tr>
    </tbody>
</table>

Additionally, loops {% for element in list %} are unable to execute when inside of a

element.

PS. Wasn't sure where to submit this bug so I submitted it to this repo.

EDIT: I think this is a dojox/dtl/tag/logic issue

1.14 is causing a `Maximum call stack size exceeded` issue in `deepCopy` in `request/util` module when passing a `xml` or `dom` node

Dojo 1.14 is causing a Maximum call stack size exceeded issue in deepCopy in request/util module when passing a xml or dom node.

While that worked in 1.13.

Here is an example:
https://codepen.io/ThibaultJanBeyer/pen/vvyVbg
(note that you’ll have to open the console of your web-browser to see the javascript error message)

Toggle between 1.13. and 1.14. See that the one is fine in 1.13 but not in 1.14

I don’t know if that is expected but it just crashed our app and took me a long time to find. So even if this is expected this issue might help someone.

Workaround: stringify the XML / HTML before passing it in the data object.

Ajax request not working with Dojo widget in Firefox

Hi,

I'm using dojo widgets in a JSF 2.2 application with the lazy code injection described here (approach 3): https://www.ibm.com/developerworks/library/wa-aj-jsfdojo/index.html

It looks like this:

<h:panelGroup id="content">
<table>
<tr>
 <td jsf2dojo='true'>
      <h:selectOneMenu id="projectOption" value="#{bean.location}">
      <f:selectItem id="select1" itemValue="Shanghai" itemLabel="Shanghai"/>
      <f:selectItem id="select2" itemValue="London" itemLabel="London"/>
      <f:selectItem id="select3" itemValue="New York" itemLabel="New York"/>
      <f:ajax render="content" />
      </h:selectOneMenu>
 </td>
</tr>
...
</table>
</h:panelGroup>

For a select the dojo widget dijit.form.FilteringSelect is used.

My problem: The ajax onchange event of the dojo widget works in Google Chrome fine, in Firefox not. Without the dojo widget, the ajax request of the select works fine.

  1. What's the problem with Firefox?

That's the error message I got in Firefox. For me it looks like a bug in parser.js than a support issue with jsf.

grafik

dijit/Viewport:global variable orientation not defined on ios

Hi there,

Saddly I am not able to submit a ticket at https://bugs.dojotoolkit.org/newticket#ticket, beacuse the spam mechanismn blocks me. So I submit the issue here, since at the dijit repo no issue section is available and the issue is dijit related. Sry for that. The related dojo version is 1.10.4..

The issue is, that DropDown's of dijit/form/FilteringSelect Elements are not shown on iOS. I think, I could nail down the reason for failing on iOS to dijit/Viewport.getEffectiveBox().

Viewport.getEffectiveBox = function(/*Document*/ doc){	
	// summary:
	//		Get the size of the viewport, or on mobile devices, the part of the viewport not obscured by the
	//		virtual keyboard.

	var box = winUtils.getBox(doc);

	// Account for iOS virtual keyboard, if it's being shown.  Unfortunately no direct way to check or measure.
	var tag = focusedNode && focusedNode.tagName && focusedNode.tagName.toLowerCase();
	if(has("ios") && focusedNode && !focusedNode.readOnly && (tag == "textarea" || (tag == "input" &&
		/^(color|email|number|password|search|tel|text|url)$/.test(focusedNode.type)))){

		// Box represents the size of the viewport.  Some of the viewport is likely covered by the keyboard.
		// Estimate height of visible viewport assuming viewport goes to bottom of screen, but is covered by keyboard.
		box.h *= (orientation == 0 || orientation == 180 ? 0.66 : 0.40);

		// Above measurement will be inaccurate if viewport was scrolled up so far that it ends before the bottom
		// of the screen.   In this case, keyboard isn't covering as much of the viewport as we thought.
		// We know the visible size is at least the distance from the top of the viewport to the focused node.
		var rect = focusedNode.getBoundingClientRect();
		box.h = Math.max(box.h, rect.top + rect.height);
	}

	return box;
};

There is a peace of code just for iOS included, which takes account for the virtual keyboard on iOS. So if a user hits the FilteringSelect, the above iOS specific peace of code, will be executed. The problem with this peace of code is, that there the global variable orientation is referenced directly, but it seems that orientation is not supported on Safari in general. https://caniuse.com/#feat=screen-orientation.

Again sry for submiting the issue here and thanks for looking into it.

Regards
Sebastian

Dateformat with time format is not displayed for korean locale in datetimepicker described under filertype :datetimepicker dojo javascript

In Dojo filtertype as datetimepicker with format yyyy.m.d for Korean language is appearing with date only ,for time format it takes 0:00 as time from the calendar by default only for korean language , how to change this format to yyyy.m.d a hh:mm for Korean as there is no explicitly defined format found in this widget
In javascript:

columns = [{
label: djpro.lz("date"),
attr: 'dateString',
sortable: true,
width: "25%",
filterType: 'datetimepicker',
formatter: dateformatter
}
where formatter is not for datetimepicker dropdown instead its for table value and there is array

var todayStr = getISOFormattedDate(new Date());
var yesterdayStr = getISOFormattedDate(new Date(new Date().getTime() - (24 * 60 * 60 * 1000)));

    fObject = {
            conjunction:"and",
            expressions: [              
            { op: "contains", attr: "dateString",value: {"to": { "ISO8601": todayStr}, "from": { "ISO8601": yesterdayStr } } }]

var table = new xwt.widget.table.Table({
id: "table",
columns: columns,
store: dataStore,
pagesToKeep:"2",
rowsPerPage:"100",
filterDelay:"1500",
queryOptions:"{ignoreCase:true}",
query:{'pageAction':'fetchAuditTableData'},
style: 'height: auto;width:98%;',
filters: filters,
defaultQuickFilterObject : fObject,
filterOnServer: true,
quickViewer: QVPanel,
quickViewDelay:"1000"
},"tableNode");

        };

1.13.1 breaks Blob submission in xhr-requests

in request.xhr.xhr() request.util.deepCopy() is called for the reuqest parameters via request.util.deepCreate().

From 1.13.1 for requests where the data-property is a Blob, the value is treated as an anonymous object and deep-copied.

Changing idProperty in dojo/store/Memory causes dijit/tree to misfunction

Take this simple example: https://dojotoolkit.org/reference-guide/1.10/dijit/Tree.html#a-programmatic-tree

If you rename all data references from id to uid, the tree can't find the right parent anymore. If you unfold any node, it will always show all the root nodes again instead of the node's child nodes. Example changes that lead to the error:

var myStore = new Memory({
	data: [
		{ uid: 'world', name:'The earth', type:'planet', population: '6 billion'},
		// removed others for brevity…
	],
	getChildren: function(object){
		return this.query({parent: object.uid});
	}
});
var myModel = new ObjectStoreModel({
	store: myStore,
	idProperty: 'uid',
	query: {uid: 'world'}
});

has('ie') not work in IE11

require(["dojo/has", "dojo/sniff"], function(has){ if(has("ie")){ // Do something specific for IE. } });
has('ie') will return undefined.

Using delay on Moveable creates possible ignored move

By listening to the "onMouseMove" on the handle, it's possible to have the moveable ignore the user's move request when a delay value is set.

on(this.handle, touch.move, lang.hitch(this, "onMouseMove")),

For an extreme example, set a delay greater than the dimensions of a moveable item's handle. Since it only listens for the "onMouseMove" event over its handle and the handle is smaller than the delay, no amount of moving will trigger a move.

A proposed solution is to set the mouse move listener on this.handle.ownerDocument (like is being done for the "onMouseUp" event [line 84]. Doing so will allow the moveable to eventually wake up and start moving the node.

DeepCopy not copying objects

I’m using deepCopy() from dojo/request/util to try to make a copy of an object that’s independent of the original object. To do this I’m using the format
var newOjb = util.deepCopy({}, oldObj);
When I do this, it looks like newObj is getting references to objects in oldObj rather than creating a new object for newObj.

SyntaxError: Invalid regular expression: /^(?:^[a-zA-Z0-9\\s-_,.'+ ]+)$/: Range out of order in character class

I get some issues as below when i run my web app in tomcat 8 but work fine in my tomcat 6.0.32,
can some body deal with this? i use dojo1.6.0 and spring mvc.

SyntaxError: Invalid regular expression: /^(?:^[a-zA-Z0-9\s-_,.'+ ]+)$/: Range out of order in character class
at new RegExp ()
at Object.validator (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/form/ValidationTextBox.js:21)
at Object.isValid (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/form/ValidationTextBox.js:25)
at Object.validate (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/form/ValidationTextBox.js:34)
at Object._refreshState (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/form/ValidationTextBox.js:63)
at Object._setRequiredAttr (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/form/ValidationTextBox.js:129)
at Object.set (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/_WidgetBase.js:196)
at _6 (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/_WidgetBase.js:51)
at Object.eval (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/_WidgetBase.js:59)
at Object.forEach (dojo.js:14)
/CHBWebAdmin/resources/dojo-1.6.0/../dijit/layout/ContentPane.js:203 Error parsing in ContentSetter#Setter_DIV_1 SyntaxError: Invalid regular expression: /^(?:^[a-zA-Z0-9\s-,.'+ ]+)$/: Range out of order in character class
at new RegExp ()
at Object.validator (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/form/ValidationTextBox.js:21)
at Object.isValid (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/form/ValidationTextBox.js:25)
at Object.validate (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/form/ValidationTextBox.js:34)
at Object._refreshState (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/form/ValidationTextBox.js:63)
at Object._setRequiredAttr (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/form/ValidationTextBox.js:129)
at Object.set (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/_WidgetBase.js:196)
at _6 (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/_WidgetBase.js:51)
at Object.eval (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/_WidgetBase.js:59)
at Object.forEach (dojo.js:14)

/CHBWebAdmin/resources/dojo-1.6.0/../dijit/_base/manager.js:16 Uncaught Error: Tried to register widget with id==group_name but that id is already registered
at Object.add (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/_base/manager.js:16)
at Object.create (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/_WidgetBase.js:31)
at Object._a6 (dojo.js:14)
at Object.create (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/_Widget.js:47)
at Object._a6 (dojo.js:14)
at Object.create (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/form/_FormWidget.js:93)
at Object.postscript (/CHBWebAdmin/resources/dojo-1.6.0/../dijit/_WidgetBase.js:15)
at new (dojo.js:14)
at eval (/CHBWebAdmin/resources/dojo-1.6.0/./parser.js:222)
at Object.forEach (dojo.js:14)

dojo/touch can stop a file input's click event (but still show the file dialog) if it's within a second of clicking something else.

Came across a strange one today. For context, we have a DropDownMenu with a MenuItem in our project that, when clicked, brings up a Dialog in which a user can upload a file (using a plain <input type="file"...> tag). If the user opens this dialog by clicking the menu item, and less than a second later clicks on the file picker then the open file dialog will open, but it will not fire any click/change events.

From what I can tell, dojo/touch is capturing this event and .stopPropagation()ing it straight away which stops the event from firing on our <input> node. But dojo/touch does not .preventDefault() for file inputs, causing the file dialog to still open and allow a file to be picked.

From what I can tell from my very basic understanding, just calling e.preventDefault() for file inputs by adding an additional check in https://github.com/dojo/dojo/blob/master/touch.js#L205 should resolve the problem.

How could I use dojo1 with npm packages?

Now we would like to use a third lib written by dojo1 in our project. We write our project based on npm packages and it seems than dojo could not been used with commonjs packages or amd packages, so many problems occurred while we used the third lib.
How could I use dojo1 with npm packages?

dateTextBox will flag a date as invalid while it's being typed

When you have a dateTextBox with min and/or max constraints on it, you can get an out of range indicator while you’re typing a valid date. For example if you have a dateTextBox with a valid range of 3/21/2018 to 3/31/2018 and you type 3/25/20 you will get an out of range message. I would expect this to see that adding 18 would make this a valid value, and not show the indicator until the control lost focus.

Remove transitions while keeping events

I'm maintaining a large web application written with the Dojo(x) Toolkit.
Here a snippet that change the current view with a transition:

showView = function (current, next, dir, type) {
    registry.byId(current).performTransition(next, dir, type, null, function () { });
};

and then in each view the UI logic listens for transition events:

registry.byId("viewCustomer").on("afterTransitionIn", function () {
    // do something
}
registry.byId("viewCustomer").on("beforeTransitionOut", function () {
    // do something else
}

I have to remove all transitions, i.e. the new view should be shown immediately without any effect. As first thought, I just set the type variable in the showView function to 'none'.

Despite it actually removes the transitions, it also breaks all the events because they won't fire anymore.

I'm looking in the documentation of Dojo to find out a way to avoid a visible transition while keeping the events. It would be ok if I can override the standard timing and set it to 0, for example.

Is there a better way to do this, without rewrite all the UI logic based on those events?

Idea: re-implement dojo/_base/declare using ES6 proxy-based metaprogramming

I don't know how good of an idea this is, but (given that someone actually figures out how to do this) it might enable:

  • higher performance of class creation and object construction
  • higher performance of calls to this.inherited

Regarding compatibility, it could do a feature check for Proxy support and use the old dojo/_base/declare implementation if necessary.

As I understand it, the entry point into meta-behavior-land would be either to return a Proxy instance from the class constructor returned from declare():

//inside clsConstructor function (in dojo/_base/declare)

var proxy = new Proxy(this, { /* trap call to [[Get]] */ });
[[user-supplied constructor]].apply(proxy, arguments);
return proxy;

or to return a constructor function from declare() with the prototype set to a proxy:

// inside declare function (in dojo/_base/declare)

clsConstructor.prototype = new Proxy(prototype, { /* trap call to [[Get]] */ ));
return clsConstructor;

I think the second approach would probably be more straightforward.

Unspecified Error from dom-geometry in IE

We have been getting the error "Unspecified Error" from IE. It looks like this error is coming from dojo/dom-geometry.js when it calls getBoundingClientRect() for a node that is not in the dom. Chrome and FireFox appear to return an object with all the values being 0, but IE throws this error and Edge appears to return an empty object.

I have an example of this error at http://embed.plnkr.co/9qBk0S/ where I use domConstruct.create to create an object, but don't place it in the dom. This also has a potential work around to handle the IE error.

Gridx - Pagination with very large Server side data with JsonRest

Hi ,
What I meant was as follows.

The Store requires data which is obtained from the server. I am beginning to
understand the design of GridX - not fully now but very soon. But what if
the client needs to load the data from the server in chunks?

We can load the data either via JsonRest or XhrGet. What if the number of
rows are so prohibitive so that the client can request the server one chunk
at a time? Like may be 25000 row at a time. This might happen when the
browser may not be able to hold so much data.

Or in a different scenerio - in my clients domain we can load only so much
rows at a time due to time it takes to build all the rows since the data in
each row is computed from so many tables, such that each request may return
only say 100 rows at a time.

So when the Gridx requests data from the Store, the store should make
additional requests to the Server.

Thanks

CLDR Albanian

CLDR for Albanian language is missing!

How to add it?
I will help with the translation.

Insecure use of eval in dojo.js

While running a security scan on our codebase a flag was raised for "insecure use of eval" in the dojo.js file line375: new Function('return eval(arguments[0]);');. As the eval function has the potential to be used for XSS attacks, it's use is not recommended.

Snort IE vulnerability

Snort users are reporting that Dojo contains an Internet Explorer vulnerability: CVE-2017-11895

Here are the Snort rules for search for that vulnerability.

alert tcp $EXTERNAL_NET any -> $SMTP_SERVERS 25 (msg:"BROWSER-IE Microsoft Edge Array type confusion attempt"; flow:to_server,established; file_data; content:"[{}]|3B|"; fast_pattern:only; content:"toString"; content:"function"; within:20; content:"slice"; within:150; metadata:policy balanced-ips drop, policy max-detect-ips drop, policy security-ips drop, service smtp; reference:cve,2017-11895; reference:url,portal.msrc.microsoft.com/en-us/security-guidance/advisory/CVE-2017-11895; classtype:attempted-user; sid:45143; rev:2;)

alert tcp $EXTERNAL_NET $FILE_DATA_PORTS -> $HOME_NET any (msg:"BROWSER-IE Microsoft Edge Array type confusion attempt"; flow:to_client,established; file_data; content:"[{}]|3B|"; fast_pattern:only; content:"toString"; content:"function"; within:20; content:"slice"; within:150; metadata:policy balanced-ips drop, policy max-detect-ips drop, policy security-ips drop, service ftp-data, service http, service imap, service pop3; reference:cve,2017-11895; reference:url,portal.msrc.microsoft.com/en-us/security-guidance/advisory/CVE-2017-11895; classtype:attempted-user; sid:45142; rev:2;)

Those rules are looking for the pattern [{}]; which can be found here: https://github.com/dojo/dojo/blob/master/_base/xhr.js#L342

Ajax request not working with Dojo widget in Firefox

Hi,

I'm using dojo widgets in a JSF 2.2 application with the lazy code injection described here (approach 3): https://www.ibm.com/developerworks/library/wa-aj-jsfdojo/index.html

It looks like this:

<h:panelGroup id="content">
<table>
<tr>
 <td jsf2dojo='true'>
      <h:selectOneMenu id="projectOption" value="#{bean.location}">
      <f:selectItem id="select1" itemValue="Shanghai" itemLabel="Shanghai"/>
      <f:selectItem id="select2" itemValue="London" itemLabel="London"/>
      <f:selectItem id="select3" itemValue="New York" itemLabel="New York"/>
      <f:ajax render="content" />
      </h:selectOneMenu>
 </td>
</tr>
...
</table>
</h:panelGroup>

For a select the dojo widget dijit.form.FilteringSelect is used.

My problem: The ajax onchange event of the dojo widget works in Google Chrome fine, in Firefox not. Without the dojo widget, the ajax request of the select works fine.

  1. What's the problem with Firefox?
  2. Is there another possibility using dojo widgets with JSF elements except from this IBM approach?
  3. After the ajax request was executed in Chrome, the "content" part doesn't contain a dojo widget anymore. How can I solve this? With dojo.addOnLoad(init); all dojo widget disappears (style="display: none").

Thank you!

dojo/touch can cause multiple click events

Here is an example application that uses multiple instances of dojo and uses dijit/form/Button from each of those instances: https://jsfiddle.net/Lu80ep4h/

The onClick event handlers for the buttons fire twice in the sample app when displayed in a touch enabled browser. The touch API can be enabled in Chrome from the chrome://flags page.

When dojo/touch loads, it registers event listeners on document. If the dojo/touch module loads multiple times, then those event listeners are loaded multiple times and cause the button's onClick method to be called multiple times for each mouse click.

In the sample app, a workaround to the problem is to modify the module map so only one instance of dojo/touch is used:

var loadMap = {
      dojo: "otherDojo",
      dijit: "otherDijit",
      "dojo/touch": "dojo/touch"
 };

It would be nice if dojo/touch could use the dojo configuration object to keep track of whether or not the document event listeners have been registered or not.

Syntax error on dojo/request/util module

I was trying a new installation from source and got some weird errors with very simple DOJO code:

image

I think the new function syntax used in the module mentioned dojo/request/util.js is not supported because the code in question has just been recently modified in #294. I looked at the repository and didn't see any matching function declarations like the one used, is that nodeJS syntax?

Slightly modifying the function declaration fixes the errors:

From

exports.deepCopy(target, source) {
	for (var name in source) {
	[... rest of the function]

To

exports.deepCopy = function(target, source) {
	for (var name in source) {
	[... rest of the function]

deepCopy implementation not IE-compatible

In #294 , we introduced syntax that is ES6, but this is not supported for IE. We need to downgrade this code (exports.deepCopy without the equals sign or function keyword), as well as forEach).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.