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
Update jquery-fix.js for DataTable allowed tags #9746
base: master
Are you sure you want to change the base?
Update jquery-fix.js for DataTable allowed tags #9746
Conversation
DataTable allowed Tag array has html tags that are non-existant. This updates the datatable tags to what they should be. Specifically allows dynamically adding rows to a DataTable.
This proposed fix is working for me. Please review. Thanks |
Can we also update jquery-fix to fix the following case:
Change to dataTableAllowedTag does not help to fix this case. This proposed solution #9293 (comment) fixes this issue <script> (function(){ const jQueryOriginalFunctions = { append: jQuery.fn.append, prepend: jQuery.fn.prepend, before: jQuery.fn.before, after: jQuery.fn.after, replaceWith: jQuery.fn.replaceWith, init: jQuery.fn.init, html: jQuery.html }; // Prevent WET-BOEW for overriding these functions without causing a TypeError in the WET-BOEW code Object.defineProperty(jQuery.fn, "append", {get:function(){return jQueryOriginalFunctions.append;}, set:function(){}}); Object.defineProperty(jQuery.fn, "prepend", {get:function(){return jQueryOriginalFunctions.prepend;}, set:function(){}}); Object.defineProperty(jQuery.fn, "before", {get:function(){return jQueryOriginalFunctions.before;}, set:function(){}}); Object.defineProperty(jQuery.fn, "after", {get:function(){return jQueryOriginalFunctions.after;}, set:function(){}}); Object.defineProperty(jQuery.fn, "replaceWith", {get:function(){return jQueryOriginalFunctions.replaceWith;}, set:function(){}}); Object.defineProperty(jQuery, "html", {get:function(){return jQueryOriginalFunctions.html;}, set:function(){}}); })(); </script> |
@Garneauma can you review, reproduce the issue and test is change request are fixing it. Thanks |
@pearl-nguyen I have just tested your fix and unfortunately it doesn't seem to fix the issue. Question: what is the intention behind adding that row? Is it simply to add a row to your datatable table? If it is, datatable has a simple way to do so: https://datatables.net/reference/api/row.add() If that is not the case, could you please explain further what is your intention with that append. Unfortunately, according to this issue: cure53/DOMPurify#324, it seems that the issue with the append is that the browser does not allow rows to be inserted outside of a table element. It is not DOMPurify itself that does not allow it. |
@pearl-nguyen Do you have any update on this? |
@Garneauma, we are in the process of rewriting our app. Therefore, we do not want to spend resources on fixing existing applications. Recent version of wet broke the javascript in our applications that require changes in many places. The propsed soluton help to fix the issue. thanks |
DataTable allowed Tag array has html tags that are non-existant.
This updates the datatable tags to what they should be.
Specifically allows dynamically adding rows to a DataTable.
Current broken jquery-fix.js file:
Proposed fix:
Related issues / Requêtes associées
#9293
#9610
Original commit that caused this issue:
581e165