Skip to content
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

Create new callback: beforeSelectionAdd #34

Open
wants to merge 202 commits into
base: master
Choose a base branch
from

Conversation

mimhof1
Copy link

@mimhof1 mimhof1 commented Oct 18, 2013

A callback that is run when a selection is made by choosing one from the results dropdown or by using the tab/comma keys to add one and fires before afterSelectionAdd. It returns false or element or altered element. If false, element is not added. Example would be to run selected element against filters, for example, check if valid email.

knalli and others added 30 commits June 15, 2012 19:17
…ection).

In general, user inputs have to be escaped before using jQuery's code-injection
features like $(..).html(maliciousUserInput). That is guaranteed now. Test
cases are attached!

Additionally, this will add support for custom html renderer. A jQuery object
which is defined via configuration key "selectedItemProp" will be appended
directly to the result or selection list. Tests cases are attached.

Because of both changes (XSS protection and custom HTML renderers), the
highlighter had to be changed to work with html escaped content. Tests cases
are attached.

In preparation for an internal rewrite of data storage I had introduced the
local "Selections" holder. Instead of trusting on a hidden field with comma
separated strings, this is a real domain object. It supports add(value),
remove(value), exists(value), getAll() and clear(). Nearly all usages of
the hidden field were replaced in favor of "Selections". For backwards
compatibility, the hidden field will be synchronized on every modification.

Note: The XSS execution issues will work with the current versions.

Following test cases will be appended
- XSS: Type a malicious code fragment which must not be executed
  (new token, no result list).
- XSS: Type a part of malicious code fragment which is part of a result
  list. Neither the result list's nor the selection list's code must be
  executed.
- Extended example/test using a custom formatter with "formatList" (basic).
- Extended example/test using a custom formatter and prefilling "preFill".
  The prefilled data should generate the selection correctly (basic).
- Extended example/test using a custom formatter, prefilling and a
  custom selection renderer.
- A combination of all tests: custom result list item renderer, custom
  selection list item renderer and XSS check.
* deleting must be working with special content, too
…ming, adds SASS, adds Mins.

# 1: I'm introducing the usage of `grunt`.
This will replace the old `make.sh` and several other manual required steps. To verify a change, just type `grunt test`. To make a new build into destination, just type `grunt build`. The default and recommended way is only `grunt` which all compile all, test all and make all required build artifacts at the destination.

Based on a common `grunt` setup this projects have a set of several additional tasks: coffee, coffeelint, cssmin, sass and a misc (utils). Credits by https://github.com/Takazudo/gruntExamples.

# 2: CoffeeScript
This plugin is now rewritten in CoffeeScript. Basically, this is still the old code base. However, some functions and loops were already optimized. But there are still some tasks to do…

# 3: SASS
The plugin's stylesheet was converted to a SASS one. Like the CoffeeScript migration, this is not a optimized SASS target.

# 4: Testing / QUnit / PhantomJS
The tests were optimized to use PhantomJS. In addition to that, `grunt` helps to start a mini web server for each test run. With the result that all tests will run in a real environment with no problems of cross origins because of a local file system.

Moreover, an additional `jquery.simulate2` was added supporting a more flexible key event instrument.
jerefrer and others added 30 commits August 5, 2013 15:07
Adds missing informations about the canGenerateNewSelections option
Allows selection by hitting ENTER if neverSubmit is true
Adds creationText option to display a line in the results to indicate it will create a new keyword
* Adds a new configuration option for `maxChars`. Works similarly to `minChars`
* Added validation message for `minChars`
* Added validation message for `maxChars`
* Added `onRenderErrorMessage` callback which can be overridden in order to
  customize validation behavior.
* Added corresponding tests.
* Updated readme and change log.
* Bumped version.
Add validation messages for `minChars` and `maxChars` fixes #24
Everywhere else we use namespace CSS selectors with `as`. It makes sense to use
the namespace on `error` as well - especially since `error` is a commonly used
class name and thus there's a high likelihood that it could cause namespace
collisions.
Add `as` namespace to validation error CSS class name
This commit addresses several bugs related to whitespace:

* You can no longer add a tags which consist entirely of whitespace
* You can no longer workaround the `minChars` validation by adding whitespace

Code changes are pretty minimal. Tests included for both these cases. Lemme
know if you have any questions.
Ignore whitespace when adding and validating tags
Add a Bitdeli Badge to README
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants