-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use jQuery to build DOM elements instead of string concatenation #411
Conversation
self.id = originalId; | ||
close = false; | ||
close = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't look like you're using this anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the close was from the old li tag opener
On Aug 27, 2014 12:19 PM, "Phil Freo" [email protected] wrote:
In src/editors/checkboxes.js:
self.id = originalId;
close = false;
close = false;
doesn't look like you're using this anywhere?
—
Reply to this email directly or view it on GitHub
https://github.com/powmedia/backbone-forms/pull/411/files#r16786363.
👍, ya I wouldn't worry about the performance of this too much... there are still very fewer DOM operations happening and overall this shouldn't be the bottleneck. But yea, some additional tests would be nice |
Do you have any thoughts on what the tests should be trying to do? Anything besides inserting some scripts that try to throw and checking the text content of the elements? |
ya I think just inserting some html characters into the various places (optgroups, options, etc) and checking that |
Labels are another spot that's problematic: By default titles probably should not be considered HTML, to prevent XSS in UGC cases, etc. However I could see cases where some people would want to use HTML, so maybe we should add a Thoughts? |
That sounds like it might be the best option. The only other thing that springs to mind is to force the title to be a template that accepts a config object, where you'd force the individual key values to be escaped and then inject those escaped values wherever the template dictated (like the change this commit made to the Radio editor template) But that sounds like a pretty awful level of complexity for what I imagine is the typical use-case. |
If titleHTML is true, then Field label content will NOT be escaped.
I'm not sure how I feel about doing the Field label escaping this way. It only applies to the default Field template. Users would need to know to add this feature if they wrote their own field template. (Although, I think bbf doesn't allow custom field templates passed in right now? That might be in another pull request of mine soon). Possible Alternatives
It also adds some whitespace around the label, which is annoying but a super long line is a style issue. |
Seems like a good idea to me since it accomplishes everything in the simplest way. But adding one extra tag printout of an empty value shouldn't cause any extra whitespace... why is it? |
Re: whitespace Re: Syntax Are you saying you support the idea of having both title and titleHTML rendered all the time? Even though I put it out there, it seems kind of weird. |
I personally am fine with it - I've done this before and there's nothing weird about it unless someone sets both @powmedia do you have any thoughts on this? |
Looking at it now, it seems like maybe Radio and Checkbox labels should be
|
Yep, seems so |
Merged, thanks! |
Took a swing at #406
All the tests are still passing.
This probably demands new tests that ensure it's properly encoding special characters.
Also, as this will frequently be MUCH slower than string concatenation, should these editors (or the top schema) have a 'trustedContent' flag or something similar? That would then use string concat instead?
It probably wouldn't ever matter. "This isn't the bottleneck you're looking for", etc.