dojo / dojox Goto Github PK
View Code? Open in Web Editor NEWDojo 1 - extras library. Please submit bugs to https://bugs.dojotoolkit.org/
Home Page: https://dojotoolkit.org/
License: Other
Dojo 1 - extras library. Please submit bugs to https://bugs.dojotoolkit.org/
Home Page: https://dojotoolkit.org/
License: Other
Reported via email:
Found a bug in Dojo 1.16.1 mobile Switch.js as shown below (with the code patched to work). What happens is that the borderTopLeftRadius is an empty string and that results in the size being NaN values, and then the browser throws an exception due to invalid SVG being injected from:
_createMaskImage: function(){
if(this._timer){
this._timer.remove();
delete this._timer;
}
if(this._hasMaskImage){ return; }
var w = domStyle.get(this.domNode,"width"), h = domStyle.get(this.domNode,"height");
this._width = (w - domStyle.get(this.knob,"width"));
this._hasMaskImage = true;
if(!(has("mask-image"))){ return; }
var rDef = domStyle.get(this.left, "borderTopLeftRadius");
if(!rDef /*CM FIX 2020-04-14*/ || rDef == "0px"){ return; }
var rDefs = rDef.split(" ");
var rx = parseFloat(rDefs[0]), ry = (rDefs.length == 1) ? rx : parseFloat(rDefs[1]);
// CM 2020-04-14: what is the point of the line of code just below?
// [commented out] var id = (this.shape+"Mask"+w+h+rx+ry).replace(/\./,"_");
// CM Optimize 2020-04-14
if ( rx && ry )
{ maskUtils.createRoundMask(this.switchNode, 0, 0, 0, 0, w, h, rx, ry, 1); }
},
The exception occurs in "Chrome" engine on Android 6 during startup of a page, when there is a resizeAll() method being called after parsing an HTML page that has Dojo switches in views, before everything is shown (that should be visible)...
Hello,
We have dojox included in our project. (Thanks! )
A recent security scan of our project shows that the API key is saved in this file: image/FlickrBadge.js.
https://github.com/dojo/dojox/blob/master/image/FlickrBadge.js
Not sure it is still used or valid. Just want to let you know. Thanks!
Only the last radio button gets the correct name attribute. All other radio buttons have the created random names.
I believe this is a duplicate of https://bugs.dojotoolkit.org/ticket/19029
However, I wanted to add a few comments. (Sorry if this isn't the right forum for these comments).
First, I use programmatic style, and the bug exists there as well (not only declarative style, as the trac ticket suggests). Furthermore, the root of the cause was introduced by dojo 1.11, _base/lang.js. In there, the definition of "isArray" was altered to use the built in Array.isArray method instead of the old way that checked for "instanceof Array".
This new technique of checking for Arrays means that NodeLists are not considered arrays. When charting/widget/Chart.js's buildRendering() is invoked, it scans for data series using dojo/query. Later, it will "foldl" those elements. foldl (dojox/lang/functional/fold.js) does a different behavior for arrays vs. objects. As of v1.11, NodeLists (as returned by query) are considered objects. It therefore invokes the callback with 0 (the value of the length attribute). Chart does not expect this.
I'm using firefox 60.3 on Windows 7.
When using one the latest Dojo Toolkit releases (either 1.11, 1.12, 1.14, 1.15 – doesn't matter which one), the canvas based rendering of charts doesn't work with dojox/charting/action2d/Tooltip
. It throws an error inside dojo.js
, saying e.contains is not a function
. The problem seems to arise from dojox/charting/Element.js
, inside the cleanGroup
method. To be honest, I haven't tested it with other actions so the same problem might occur with them as well.
I've created a JSFiddle which shows the issue:
https://jsfiddle.net/urbandrone/dxog68hk/1/
HTML
<div class="chart"></div>
JavaScript
require([
'dojox/charting/Chart',
'dojox/charting/plot2d/Columns',
'dojox/charting/axis2d/Default',
'dojox/charting/action2d/Tooltip'
], function (Chart, PlotType, Axis2D, Tooltip) {
var container = document.querySelector('.chart');
var data = [10, 20, 30, 20, 50, 40];
var chart = new Chart(container);
chart.addPlot('default', {
type: PlotType,
labels: true,
labelStyle: 'inside',
omitLabels: false,
gap: 10,
minBarSize: 33,
maxBarSize: 33
});
chart.addAxis('x', { type: Axis2D, vertical: false });
chart.addAxis('y', { type: Axis2D, vertical: true });
chart.addSeries('series a', data);
var tooltip = new Tooltip(chart, 'default');
chart.render();
})
As shown in the JS panel of the fiddle, it uses version 1.12.2 to create a simple chart with tooltips but throws the above mentioned error when the chart is created. Switching the version to 1.10 prevents it from throwing the error, so there must have been a change between 1.10 and 1.11 which causes the problem.
For the application I'm working on I cannot switch back to an older release. However, I also cannot just use the SVG based rendering, because that'll create an awful lot of nodes inside the DOM which massively drops performance in all browsers (all in all, SVG based rendering currently produces ~16.000 nodes while canvas based rendering "only" produces less then 9.500 nodes for the same page) and sometimes causes them to freeze completely.
Hi,
I believe I've found a security vulnerability. Please open a security advisory and add me to it so we can discuss it.
https://github.com/dojo/dojox/security/advisories
When the only text inside an attribute is a DTL expression (eg: value='{%if fruit %}{{fruit}}{% endif %}'
) and after rendering that expression results in an empty string, dojo keeps the DTL expression unmodified inside the attribute. This is troublesome especially for input tags where the value attribute is visible to the user.
Inserting any text inside the attribute so as the resulting attribute is no longer empty after the rendering resolution prevents the problem from happening (eg: value=' {%if fruit %}{{fruit}}{% endif %}'
, notice the space right after the opening quote).
index.html
<!DOCTYPE html>
<html>
<head>
<script>var dojoConfig={async:true,locale: \"en-US\"};</script>
<script src=\"dojo-release-1.13.0-src/dojo/dojo.js\"></script>
<script>
require([
'dojo/modules/DtlWidget',
'dojo/domReady!'
], function(DtlWidget) {
const demo = new DtlWidget();
demo.placeAt('widgetTest');
});
</script>
</head>
<body>
<div id="widgetTest">
</body>
</html>
DTLWidget.js
define([
"dojo/_base/declare",
"dojox/dtl/_DomTemplated",
"dojox/dtl/tag/logic",
"dijit/_WidgetBase",
"dijit/_WidgetsInTemplateMixin",
"dijit/layout/ContentPane",
"dojo/parser",
"dojox/dtl/Context"
], function(declare, DomTemplated, logic, _WidgetBase, _WidgetsInTemplateMixin, ContentPane, parser, context) {
return declare("DtlWidget", [_WidgetBase, DomTemplated, _WidgetsInTemplateMixin], {
templateString: "<div><input value='{%if fruit %}{{fruit}}{% endif %}' type='text'></input></div>",
postCreate : function() {
// Uncomment these lines to have the template render correctly
//this.fruit = "Apple";
//this.render();
}
});
});
<body data-gr-c-s-loaded="true">
<div id="widgetTest">
<input value="{%if fruit %}{{fruit}}{% endif %}" type="text" id="DtlWidget_0" widgetid="DtlWidget_0"></div></body>
For the more visually inclined:
Expected the input tag to be empty after the rendering process because the variable that the template references does not exist in its context.
I think I found a bug in dojox/grid/_Grid::defaultUpdate() that leads to a recursion error.
I posted about it in the forums here, seeking a potential better solution (perhaps using beginUpdate/endUpdate would be better?):
https://discourse.dojo.io/t/bug-in-dojox-grid-grid/436
Basically, because defaultUpdate() doesn't flag itself as 'updating', it can continue to be called by dojox/grid/_View::hasVScrollbar() which then eventually calls hasVScrollbar, and on and on .
I've only been able to reproduce the issue when the grid contains 7 rows - for whatever reason.
@gardiol commented on Mon Mar 05 2018
Creating a MouseIndicator on an empty data set result in lots of undefined errors in the console log.
To fix this, it's a very very simple fix in dojox/charting/action2d/_IndicatorElement.js.uncompressed.js at row 305: add "else if ( r )":
if(typeof r == "number"){ x = i+1; y = r; if(i > 0){ px = i; py = data[i-1]; } }else if ( r ){ x = r.x; y = r.y; if(i > 0){ px = data[i-1].x; py = data[i-1].y; } }
Because if data is an empty list ([]) the above if will end up in the "else" statement and try to assign r.x to x. Changing the "else" to "else if ( r )" fix it without side-effects, at least i can see.
@dylans commented on Mon Mar 05 2018
This repo is for general Dojo 2 issues... moving this issue to dojo/dojox. If you would like to raise a PR per the contribution guidelines, we'll review it and land it for a future version of Dojo 1.x.
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;
I have set up a request mock, registering URLs with dedicated response data in my intern test setup as suggested in a blog post.
However, as far I understand Uploader
does not use dojo/request
so the recommended solution does not work as intended. Is there a similar solution how to mock uploading a file? In my case it is an external API which I do not want to spam with test files.
I use Dojo v1.11
The current rating widget uses a list with no accessible text or keyboard interaction.
Both the W3C example and many other accessible rating widgets use radio buttons as a base. The existing hidden input could be swapped out for a set of radio buttons corresponding to the number of stars.
Currently there is an issue with the Umm al-Qura calendar, the pop-up calendar automatically sets the date incorrectly.
After further investigate I found the issue to be the re-implementation of the UMM Al-Qura calendar. To further verify that this is the issue I tested with version 1.10 and got the correct date. I tested with 1.12 and it is broken. The main issue is with the Date.js file that was changed.
Reproduction Steps:
Get the Um Al-Qura data before 12PM. Then get it after 12PM. You will see that the date has changed. Here is a URL to check the current date of the Umm Al-Qura. https://webspace.science.uu.nl/~gent0113/islam/ummalqura_converter.htm
Below is the URL for the dojo bug that this was filed for and the Pull Request that was merged which broke the Umm Al-Qura date.
We need support to solve this issue as it is urgent.
If the cells in a DojoX grid throw an error on focus, clicking on a cell can cause the browser to scroll the grid out of view.
Steps to reproduce:
grid/tests
directory and copy the "Test HTML File" content below into the new file. This is the test_edit.html
file with the following modifications:
<div>
was added to the top of the body for padding.focus()
is called.The browser will scroll up into the padding <div>
and most likely scroll the grid out of view. You can click on other cells in the grid to see how it normally behaves.
When you click on a cell, _FocusManager@setFocusCell
is called. That method first sets focus on a zero height/width input in a _View
object. The CSS absolutely positions that input 1000 pixels above the _View
domNode so focusing on it causes the browser to scroll up.
Next, setFocusCell
calls _FocusManager@_focusifyCellNode(true)
to focus on the cell that received the click event. _focusifyCellNode
calls util.fire(n, "focus");
to set the focus on the table cell node.
_focusifyCellNode: function(inBork){
var n = this.cell && this.cell.getNode(this.rowIndex);
if(n){
html.toggleClass(n, this.focusClass, inBork);
if(inBork){
var sl = this.scrollIntoView();
try{
if(has("webkit") || !this.grid.edit.isEditing()){
util.fire(n, "focus");
if(sl){ this.cell.view.scrollboxNode.scrollLeft = sl; }
}
}catch(e){}
}
}
},
Notice the call to util.fire
is wrapped in a try-catch
block. This suggests that errors may occur but the errors are swallowed by the do-nothing catch
block. If the call to focus
fails, the browser focus remains on the zero height/width input.
Two suggestions:
focus
fails in _focusifyCellNode
, make the code attempt to focus on some other part of the grid.console.error
or console.warn
in the catch
block of _focusifyCellNode
so developers are aware of any focus errors? There are other methods in _FocusManager
that have smiliar empty catch
blocks.Test HTML File
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Test dojox.grid.DataGrid Editing</title>
<style>
@import "../resources/Grid.css";
body {
font-family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
}
.dojoxGridRowEditing td {
background-color: #F4FFF4;
}
.dojoxGrid input, .dojoxGrid select, .dojoxGrid textarea {
margin: 0;
padding: 0;
border-style: none;
width: 100%;
font-size: 100%;
font-family: inherit;
}
.dojoxGrid input {
}
.dojoxGrid select {
}
.dojoxGrid textarea {
}
#controls {
padding: 6px 0;
}
#grid {
width: 850px;
height: 350px;
border: 1px solid silver;
}
</style>
<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug:false, parseOnLoad: true"></script>
<script type="text/javascript">
dojo.require("dojox.grid.DataGrid");
dojo.require("dojo.data.ItemFileWriteStore");
dojo.require("dojo.parser");
</script>
<script type="text/javascript" src="support/test_data.js"></script>
<script type="text/javascript">
// ==========================================================================
// Custom formatter
// ==========================================================================
formatMoney = function(inDatum) {
return isNaN(inDatum) ? '...' : '$' + parseFloat(inDatum).toFixed(2);
}
// ==========================================================================
// Grid structure
// ==========================================================================
statusCell = { field: 'col3', name: 'Status', styles: 'text-align: center;', type: dojox.grid.cells.Select, options: [ "new", "read", "replied" ] };
gridLayout = [{
defaultCell: { width: 8, editable: true, styles: 'text-align: right;' },
cells: [
{ name: 'Id', field: 'id', width: 3 },
{ name: 'Priority', field: 'col1', styles: 'text-align: center;', type: dojox.grid.cells.Select, options: ["normal", "note", "important"] },
{ name: 'Mark', width: 3, field: 'col2', styles: 'text-align: center;', type: dojox.grid.cells.Bool },
statusCell,
{ name: 'Message', field: 'col4', styles: '', width: '100%' },
{ name: 'Amount', field: 'col5', formatter: formatMoney },
{ name: 'Amount', field: 'col6', formatter: formatMoney }
]
},{
defaultCell: { width: 4, editable: true, styles: 'text-align: right;' },
rows: [
{ name: 'Mark', width: 3, field: 'col2', styles: 'text-align: center;', type: dojox.grid.cells.Bool},
statusCell,
{ name: 'Amount', field: 'col5', formatter: formatMoney},
{ name: 'Detail', value: 'Detail'}
]
}];
// ==========================================================================
// UI Action
// ==========================================================================
addRow = function(){
test_store.newItem({
id: grid.rowCount,
col1: 'normal',
col2: false,
col3: 'new',
col4: 'Now is the time for all good men to come to the aid of their party.',
col5: 99.99,
col6: 9.99,
col7: false
});
}
</script>
</head>
<body>
<div style="height: 1500px">Padding. Scroll down to see the grid.</div>
<h2>
dojox.grid.DataGrid Basic Editing test
</h2>
<div id="controls">
<button onclick="grid.render()">Refresh</button>
<button onclick="grid.edit.focusEditor()">Focus Editor</button>
<button onclick="grid.focus.next()">Next Focus</button>
<button onclick="addRow()">Add Row</button>
<button onclick="grid.removeSelectedRows()">Remove</button>
<button onclick="grid.edit.apply()">Apply</button>
<button onclick="grid.edit.cancel()">Cancel</button>
<button onclick="grid.singleClickEdit = !grid.singleClickEdit">Toggle singleClickEdit</button>
</div>
<br />
<div id="grid" dojoType="dojox.grid.DataGrid"
data-dojo-id="grid"
rowSelector="20px"
store="test_store" structure="gridLayout"></div>
<br />
<div id="rowCount"></div>
<script>
require(["dojo/ready"], function (ready) {
ready(function () {
var view = document.getElementById("dojox_grid__View_2");
var cell = view.querySelectorAll(".dojoxGridCell")[0];
cell.focus = function () {throw new Error("It failed")};
});
});
</script>
</body>
</html>
In closable
floatingPane, when I close the FloatingPane and try to reopen it, it throws error.
There seems to be issue in Dojo Framework itself cause I can face the same issue in Documentation sample itself.
For sample, you can refer to the page: dojox.layout.FloatingPane
in this sample follow below steps to reproduce the issue:
dojox.form.FileUploader stop working after upgrade to 14.1
.
On 13.0 was working fine.
https://archive.dojotoolkit.org/nightly/dojotoolkit/demos/uploader/demo.html
When using a widget with a template, elements that are rendered inside of a <table>
element are not parsed properly.
This template:
{{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>
This also applies to for loops {% for element in list %}
, which are unable to loop through elements when they are placed inside a <table>
Uploader progress doesn't show the real percentage of upload.
When i upload the percentage goes 100% but the file hasn't uploaded yet.
lang/functional/lambda.js makes use of Function(string), which causes unsafe-eval violations.
on line 122, we have:
return lcache[s] = new Function(l.args, "return (" + l.body + ");");
I'm currently using functionalities in dojox/charting and get unsafe-eval errors because it frequently calls the code above.
For example, from line 47 to 52 in charting/Chart.js, we have:
clear = func.lambda("item.clear()"), purge = func.lambda("item.purgeGroup()"), destroy = func.lambda("item.destroy()"), makeClean = func.lambda("item.dirty = false"), makeDirty = func.lambda("item.dirty = true"), getName = func.lambda("item.name"),
According to Dojo 1.11 Release Notes, Dojo should be compliant with CSP since 1.11, does this only apply to Dojo core? If yes, will this issue be addressed in the near future? Thanks!
https://bugs.dojotoolkit.org/ticket/12174 actually addresses issue 1 but did not fix it
I will fix https://bugs.dojotoolkit.org/ticket/12954 since i am already there.
I have observed a strange behaviour of the DataGrid. When the grid has exactly 26 rows and you add another row, it is not shown unless the last row was selected. It looks like the graphical representation of the grid is not being updated.
The problem can be reproduced with the example Adding and Deleting data found in the reference - after fixing two minor bugs in the example. I also increased the width of the 3rd column, because line breaks slightly change the behaviour. So does a horizontal scroll bar.
I am upgrading the Dojo 1.13.0 to 1.16.2 in the project. While doing custom build am getting around 60 errors which are similar to the bellow in build report.
Root: dojox/grid/nls/DataGrid_ar; missing bundles: 'dijit/nls/loading'.
and one more issue with missing dependency like bellow
error(311) Missing dependency.
module: dojox/mobile/app/compat.js.uncompressed; dependency: ./_base/loader
kindly let me know what is the problem.
If you have a large DataGrid and you have scrolled down, it is impossible to double-click a certain row in Google Chrome, if that row is not in the center of the viewport. When the grid recognised the first click, it focuses the corresponding cell, which centers it inside the viewport so the second click will hit another row and the double-click event will be fired for the second row.
I have prepared a fiddle demonstrating the problem. It shows a grid with 100 rows and autoheight attribute enabled. If you e.g. scroll down so that row 50 is shown on the lower end of the viewport and try to double-click it, you will end up double-clicking e.g. row 65.
The problem does not show in Firefox. I could trace down the scrolling to this code line. It's executed only for Webkit browsers.
I just noticed a really specific case where the value attribute from an option tag would not be rendered properly.
Problem
When you attempt to render an option tag that has the same DTL expression for both its value attribute and innerHTML the value attribute does not get rendered.
Eg:
file.template
<div>
<select>
<option value="{{fruit}}">{{fruit}}</option>
</select>
</div>
context object
{ fruit : "Fruit" }
result
<div id="Widget_0" widgetid="Widget_0">
<select><option value="{{fruit}}">Fruit</option></select>
</div>
(notice that the value attribute has not changed)
You can see it live in this fiddle (inspect the elements of the created combo box).
may be broken since v1.12
some similar code than:
run = arr.map(this.run.data, function(item, i){
if(typeof item != "number" && item.hidden){
this.runFilter.push(i);
item.hidden = false;
}
if(arr.some(this.runFilter, function(filter){return filter == i;})){
if(typeof item == "number"){
return 0;
}else{
return {y: 0, text: item.text};
}
}else{
return item;
}
}, this);
is missing in Pie.js
SelectableLegend.js populates plot's runFilter-array, but it's never taken into account
We have upgraded from 1.10 to 1.16 and noticed that some of our widgets using dojox/dtl/_Templated
did not work any more because the sub-widgets contained in the template were not created.
Investigating a little more, it appears to be caused by this commit in dijit that removes the widgetsInTemplate
flag. This flag is still expected by dojox/dtl/_Templated
to decide to parse sub-widgets, though.
Our workaround is to add the flag explicitly in our widgets. Everything seems to work fine then.
I don't know if there is enough interest to fix this in dtl, but a cleaner solution would be to do the same detection in dtl as in dijit to know if there are any widgets in the template.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.