-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(de)serialize contenteditable elements
Form elements are now fetched with `Syphon.InputFetcher`, instead of the private `getForm` function. By default, this will fetch `contenteditable` elements in addition to inputs and checkboxes. "Content editable" fields are handled as follows: * must have `contenteditable="true"` (having only `contenteditable` present is *NOT* sufficient, even though it conforms to the HTML spec) * must define a `data-name` property, which is used like a standard `input` field's `name` property * data in read/written using jQuery's `html()` method
- Loading branch information
Showing
10 changed files
with
115 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Backbone.Syphon.InputFetcher | ||
// ---------------------------- | ||
|
||
// If a dom element is given, just return the form fields and | ||
// elements with "contenteditable". | ||
// Otherwise, get the form fields (and contenteditable elements) from the view. | ||
Syphon.InputFetcher = function(viewOrForm) { | ||
var inputs = ':input, [contenteditable=true]'; | ||
if (_.isUndefined(viewOrForm.$el)) { | ||
return $(viewOrForm).find(inputs); | ||
} else { | ||
return viewOrForm.$(inputs); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters