mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-04 20:45:58 +01:00
Use attr() instead of data() to prevent parsing of json (#2548)
* Use attr() instead of data() to prevent parsing of json A fix for issue #2503 Valid JSON text will be converted to a JSON object, not text , when using .data(). using .attr() prevents this behavior. * Update gitbucket.js Use different methods to get old and head values depending on the object type
This commit is contained in:
@@ -77,10 +77,12 @@ function displayErrors(data, elem){
|
||||
*/
|
||||
function diffUsingJS(oldTextId, newTextId, outputId, viewType, ignoreSpace) {
|
||||
var old = $('#' + oldTextId), head = $('#' + newTextId);
|
||||
old.is("textarea") ? (oldTextValue = old.data('val')) : (oldTextValue = old.attr('data-val'));
|
||||
head.is("textarea") ? (headTextvalue = head.data('val')) : (headTextValue = head.attr('data-val'));
|
||||
var render = new JsDiffRender({
|
||||
oldText : old.data('val'),
|
||||
oldText : oldTextValue,
|
||||
oldTextName: old.data('file-name'),
|
||||
newText : head.data('val'),
|
||||
newText : headTextValue,
|
||||
newTextName: head.data('file-name'),
|
||||
ignoreSpace: ignoreSpace,
|
||||
contextSize: 4
|
||||
|
||||
Reference in New Issue
Block a user