По ряду причин я получил код, в котором необходимо хранить сериализованные объекты JSON внутри тегов атрибутов HTML.
Однако я столкнулся с проблемой, когда один из моих сериализованных объектов json содержит апостроф и в результате, похоже, нарушает работу jQuery.
По сути, это поведение ...
Вот определение заголовка таблицы.
<table class='DraggableRowTable' RowData='{"AuthorID":"652c90e4-ffef-49c5-9217-0ff39a461011","Created":"\/Date(1319429903223+1100)\/","EditorID":"652c90e4-ffef-49c5-9217-0ff39a461011","Modified":"\/Date(1319429903223+1100)\/","AssignedToID":"7daef058-d84c-43f5-9db1-8011c59673ee","DetailedTaskID":"169ea939-7cb7-4599-9c2a-9e8ef4dee641","Duration":4.0000,"EndDate":"\/Date(1319497200000+1100)\/","ManualCalculation":false,"RoleID":"944f0ea3-4312-4f14-9d00-c968a647996a","Sequence":14,"StartDate":"\/Date(1319429872333+1100)\/","Status":0,"SubSequence":0,"Task":{"AuthorID":"652c90e4-ffef-49c5-9217-0ff39a461011","Created":"\/Date(1319172394650+1100)\/","EditorID":"652c90e4-ffef-49c5-9217-0ff39a461011","Modified":"\/Date(1319172394650+1100)\/","AssignedToID":"7daef058-d84c-43f5-9db1-8011c59673ee","Duration":4,"IsActive":true,"ProductID":"dad82b06-7d28-4255-bf02-f709eeed64cd","RoleID":"944f0ea3-4312-4f14-9d00-c968a647996a","Sequence":14,"TaskDescription":"es reviewer is to review the following fields and provide feedback to the writer if they' need fixing:\u000d\u000a*description\u000d\u000a*key learning objectives\u000d\u000a*educational value statements","TaskID":"6f577537-ce4a-46cd-9eb6-29bd5756ab26","TaskName":"educational soundness review"},"TaskID":"6f577537-ce4a-46cd-9eb6-29bd5756ab26","WorkOrder":{"AuthorID":"652c90e4-ffef-49c5-9217-0ff39a461011","Created":"\/Date(1319429872333+1100)\/","EditorID":"652c90e4-ffef-49c5-9217-0ff39a461011","Modified":"\/Date(1319429872333+1100)\/","IsActive":true,"Priority":1,"ProductID":"dad82b06-7d28-4255-bf02-f709eeed64cd","Qty":1,"StartDate":"\/Date(1319429872333+1100)\/","Status":0,"Subtitle":null,"WorkOrderDescription":null,"WorkOrderExternalID":43,"WorkOrderID":"66c40ff8-56e1-4009-89ab-989b0e25d120","WorkOrderName":"Work order #43"},"WorkOrderID":"66c40ff8-56e1-4009-89ab-989b0e25d120"}'>
А вот и код.
var Data = $(GridRow).find(".DraggableRowTable").attr("RowData");
//Data = "{"AuthorID":"652c90e4-ffef-49c5-9217-0ff39a461011","Created":"\/Date(1319429903223+1100)\/","EditorID":"652c90e4-ffef-49c5-9217-0ff39a461011","Modified":"\/Date(1319429903223+1100)\/","AssignedToID":"7daef058-d84c-43f5-9db1-8011c59673ee","DetailedTaskID":"169ea939-7cb7-4599-9c2a-9e8ef4dee641","Duration":4.0000,"EndDate":"\/Date(1319497200000+1100)\/","ManualCalculation":false,"RoleID":"944f0ea3-4312-4f14-9d00-c968a647996a","Sequence":14,"StartDate":"\/Date(1319429872333+1100)\/","Status":0,"SubSequence":0,"Task":{"AuthorID":"652c90e4-ffef-49c5-9217-0ff39a461011","Created":"\/Date(1319172394650+1100)\/","EditorID":"652c90e4-ffef-49c5-9217-0ff39a461011","Modified":"\/Date(1319172394650+1100)\/","AssignedToID":"7daef058-d84c-43f5-9db1-8011c59673ee","Duration":4,"IsActive":true,"ProductID":"dad82b06-7d28-4255-bf02-f709eeed64cd","RoleID":"944f0ea3-4312-4f14-9d00-c968a647996a","Sequence":14,"TaskDescription":"es reviewer is to review the following fields and provide feedback to the writer if they" //As you can see, it all breaks here...
Так что, думаю, яИнтересно, во-первых, допустимо ли иметь апострофы в атрибутах HTML (IE: поддерживает ли это стандарт HTML), а во-вторых (в зависимости от ответа на первый вопрос) должна ли jQuery быть способна правильно возвращать этот атрибут?