GithubHelp home page GithubHelp logo

Comments (4)

dmethvin avatar dmethvin commented on June 27, 2024

The only elements allowed inside a TR are TD or TH. Anything else is invalid markup.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr#technical_summary

For a string that is valid markup, jQuery would have created valid DOM elements for it. So now it's a question of how invalid markup should be handled, which is often not very well defined. I don't know if this is covered in a spec.

At least for a recent Chrome, it appears that any invalid element that has content and appears in a TR is effectively converted to a TD even if you use DOM methods.
https://jsfiddle.net/rbzkt239/

Again in Chrome, non-content elements like SCRIPT and LINK don't create a TD. Since the DOM methods don't execute embedded scripts like jQuery, it's not quite the same.
https://jsfiddle.net/7sxwdmk0/

Is the script supposed to be executed in this case? If so, does the ajaxResponse injection assume you're using jQuery?

from jquery.

ghemberg avatar ghemberg commented on June 27, 2024

So now it's a question of how invalid markup should be handled

That's not for me to say, so I won't go into that.

All I notice, is that SCRIPT tag inside a TR does appear to work in both Firefox and Edge (didn't check any other browser).

Is the script supposed to be executed in this case?

Yes. It is a cookie being set by a "WebSeal" server that handles security matters (authentication, authorization).

If so, does the ajaxResponse injection assume you're using jQuery?

It does not (and can't as it is supposed to work with any text/html response (regardless of whether jQuery is used or not).

from jquery.

dmethvin avatar dmethvin commented on June 27, 2024

The only way it would work without jQuery is if the browser loaded the response as a complete web page.

With jQuery, injecting a script works: https://jsfiddle.net/c0r9y4vd/

Without jQuery, it does not: https://jsfiddle.net/7sxwdmk0/

You might want to check with the WebSeal group or documentation and see what their advice is for implementing AJAX requests. The mentions I could find seem to indicate this is very old tech, so if it's a problem I'm surprised it hasn't come up before: https://serverfault.com/questions/47148/reverse-proxies-and-ajax

I'll leave it to the team as to whether a scenario like this should be supported.

from jquery.

timmywil avatar timmywil commented on June 27, 2024

Thanks for opening an issue. We discussed in the meeting. This falls under when you give unexpected input, you'll get unexpected output. While it's admittedly strange that the TDs are lost, the script tag is invalid. Besides, we'd prefer not to build in special case logic for things like this because it would never end.

However, if you know the response might be weird, the script could instead be appended separately with .append(...ajaxResponse.match(/^<script.*?<\/script>|.+/gis)).

from jquery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.