Stripping CSS single quotes

Last post 09-03-2008, 11:45 PM by MrFreelancer. 2 replies.
Sort Posts: Previous Next
  •  08-31-2008, 2:25 PM 43397

    Stripping CSS single quotes

    Hopefully some one has an answer and work around for this.
     
    My CSS single quotes are being stripped when going between "HTML" and "Normal" views. for example....
    this => style="background: url('my/image/path');"
    gets replace by
    this => style="background: url(my/image/path);"
     
    As well, this occurs if I try to load a template that contains such markup... thus breaking it.
     
    The problem is, in firefox (all versions of firefox), this breaks the display, since firefox will then "clean up" the code by removing it and replacing it with it's own codes such as "-moz" tags.
     
    Or is there anyway to prevent firefox from altering/removing code?
     
    Thanks;
    -Drew
  •  09-02-2008, 10:07 PM 43452 in reply to 43397

    Re: Stripping CSS single quotes

    Drew,
     
    This is Internet Explorer behaviour. We still can't find an elegant workaround.

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  09-03-2008, 11:45 PM 43538 in reply to 43452

    Re: Stripping CSS single quotes

    Actually, it's a Firefox bahaviour as well. All 3 versions of Firefox (1,2,3). It would be nice to have it resolved, however in the meantime, I've simply created a post "clean-up" if you will via regular expressions.
     
    The thing is, if you were to "paste" a layout into it, no prob. However, the minute you view the "source" or submit the editing, it will then strip them.
     
    Possible Idea??....
    why not simply run a javascript regular expression if flopping between "normal & "html" modes and also upon submit?

    In fact, here's a quick script I wrote that I also implemented on my version for my site
    ....
     
    /*=====CODE SNIPPET SAMPLE=============*/
     
    var value="background: url(http://freelancerlisting.net)";
    var xpress=/url\(([a-zA-Z0-9:\/\.\?\&\=]+)\)/g;
    value=value.replace(xpress,"url('$1')");
    alert(value);
     
    /*=================================*/
     
    This basically will do a scan of the whole document for anything that matches the 'xpress' (regular express) and will do a global replace of the string you feed it. In this case, the var of 'value'. This script will add those missing 'single' quotes back into the url() css attribute.... cross-browser.
View as RSS news feed in XML