开发者

How will jQuery features in a blog post look inside RSS?

I've made a nice jQuery show/hide button for part of a blog post (it's a template for a cartoon, so show all > hide all, using the .toggle() function in jQuery).

However, lots of my readers consume the cartoon via RSS.

How will the jQuery interact with RSS? I can't test it without actually publishing a post, which I'm obviously loath to do.

The jQuery I use is as follows:

<script type="text/javascript">// <![CDATA[
        $(document).ready(function() {
             $('#fullcart开发者_如何转开发oon').hide();
             $('#showfull').click(function() {
                  $('#fullcartoon').toggle('slow');
             });
        });
// ]]></script>

i.e. I do all the hiding in jQuery - if you don't have javascript enabled in the browser, the cartoon isn't hidden at all.

I'm quite happy for the same to be the case in RSS, but I don't want to accidentally end up hiding half the cartoon. What do people think?

Thanks!


I would expect whatever you're using to generate the RSS descriptions (synopses) to strip out the script, and separately would expect RSS readers to do so if script were present in the descriptions. And so since you're using progressive enhancement (not hiding the cartoon unless your script runs), I'd expect it to look fine. You can easily test the first half of that (what your generator generates) by looking at the RSS feed directly; the second part (what the reader does with script) may well vary by reader.

If your RSS generator includes the script and an RSS reader does execute it, I'd expect a reader executing script to be taking the necessary steps to ensure that the script is executing in an appropriate context (an iframe, perhaps) so that it works. If it doesn't, it's a bug in the reader (in my humble view).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜