Closed
Bug 723431
Opened 14 years ago
Closed 14 years ago
DOMTemplate should allow customisation of display of null/undefined values
Categories
(DevTools :: General, defect)
DevTools
General
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 15
People
(Reporter: jwalker, Assigned: jwalker)
References
Details
Attachments
(1 file, 2 obsolete files)
|
10.71 KB,
patch
|
dcamp
:
review+
|
Details | Diff | Splinter Review |
Currently:
<div id=a>${foo}</div>
+
domtemplate('a', { foo: null });
V
<div id=a>null</div>
This is good for debugging, but it's annoying - frequently you want null/undefined to show up as an empty string.
We should add an option so:
<div id=a>${foo}</div>
+
domtemplate('a', { foo: null }, { blankNullUndefined: true });
V
<div id=a></div>
| Assignee | ||
Updated•14 years ago
|
Assignee: nobody → jwalker
Status: NEW → ASSIGNED
| Assignee | ||
Comment 1•14 years ago
|
||
| Assignee | ||
Comment 2•14 years ago
|
||
Attachment #594990 -
Flags: review?(dcamp)
| Assignee | ||
Comment 3•14 years ago
|
||
If you'd like to see the extra parts cut-up github style: https://github.com/campd/gcli/pull/14
Comment 4•14 years ago
|
||
Comment on attachment 594990 [details] [diff] [review]
upload 1
Review of attachment 594990 [details] [diff] [review]:
-----------------------------------------------------------------
::: browser/devtools/shared/Templater.jsm
@@ +54,5 @@
> * @param node A DOM element or string referring to an element's id
> * @param data Data to use in filling out the template
> * @param options Options to customize the template processing. One of:
> * - allowEval: boolean (default false) Basic template interpolations are
> + * either property paths (e.g. ${a.b.c.d}), however if allowEval=true then we
This isn't new, but that 'either' seems to be missing an 'or'.
Attachment #594990 -
Flags: review?(dcamp) → review+
| Assignee | ||
Comment 5•14 years ago
|
||
<blush>
I forgot to do the null/undefined processing on attribute values. See here for the fix:
} else {
// Replace references in all other attributes
var newValue = value.replace(this._templateRegion, function(path) {
- return this._envEval(path.slice(2, -1), data, value);
+ var insert = this._envEval(path.slice(2, -1), data, value);
+ if (this.options.blankNullUndefined && insert == null) {
+ insert = '';
+ }
+ return insert;
}.bind(this));
// Remove '_' prefix of attribute names so the DOM won't try
// to use them before we've processed the template
Also this fixes your note about the either/or in the doc-comment, and adds tests for the above change.
Attachment #594990 -
Attachment is obsolete: true
Attachment #596797 -
Flags: review?(dcamp)
Updated•14 years ago
|
Attachment #596797 -
Flags: review?(dcamp) → review+
| Assignee | ||
Comment 6•14 years ago
|
||
| Assignee | ||
Comment 7•14 years ago
|
||
You reviewed this ages ago, but I never committed.
I re-pushed to try (https://tbpl.mozilla.org/?tree=Try&pusher=jwalker@mozilla.com) and rolled in the one char fix to bug 736831, which you reviewed yesterday:
https://github.com/joewalker/gcli/commit/d4d93245aff9ad3cdd81733696443bd8a416844d and
https://github.com/campd/gcli/pull/27#issuecomment-4883212
It seems like a no-brainer that I can commit this, but I'm just checking.
Attachment #596797 -
Attachment is obsolete: true
Attachment #611850 -
Flags: review?(dcamp)
Updated•14 years ago
|
Attachment #611850 -
Flags: review?(dcamp) → review+
| Assignee | ||
Comment 8•14 years ago
|
||
| Assignee | ||
Updated•14 years ago
|
Whiteboard: [fixed-in-fx-team]
Comment 9•14 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 15
Comment 10•14 years ago
|
||
This patch was in a range which caused a Ts regression, so I backed out the whole range:
https://hg.mozilla.org/mozilla-central/rev/24a6a53c714a
Please reland after investigating and fixing the regression.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 11•14 years ago
|
||
Whiteboard: [fixed-in-fx-team]
Comment 12•14 years ago
|
||
Status: REOPENED → RESOLVED
Closed: 14 years ago → 14 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Updated•8 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•