<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel>
	  <title>Ask MetaFilter questions tagged with webkit</title>
      <link>http://ask.metafilter.com/tags/webkit</link>
      <description>Questions tagged with 'webkit' at Ask MetaFilter.</description>
	  <pubDate>Tue, 10 Feb 2009 15:44:07 -0800</pubDate> <lastBuildDate>Tue, 10 Feb 2009 15:44:07 -0800</lastBuildDate>

      <language>en-us</language>
	  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
	  <ttl>60</ttl>	  
	<item>
	<title>CSSFilter: Webkit won&apos;t keep my elements in their fixed width container.</title>
	<link>http://ask.metafilter.com/113887/CSSFilter%2DWebkit%2Dwont%2Dkeep%2Dmy%2Delements%2Din%2Dtheir%2Dfixed%2Dwidth%2Dcontainer</link>	
	<description>CSSFilter: I am building a wordpress site that uses a basic two column layout with floating  div elements inside a fixed-width div . Any clues why Safari and Chrome appear to be ignoring the fixed-width container div allowing the interior elements to float away to the edges of the browser?  Explorer and Firefox aren&apos;t doing this. I&apos;ll admit that the template is now a total hack, but I&apos;m hoping there&apos;s some well-known quirk or mistake that would cause webkit to ignore the container.  If it&apos;s any help, the floating elements are right up at edge of the browser window without any padding...</description>
	<guid isPermaLink="false">tag:ask.metafilter.com,2009:site.113887</guid>
	<pubDate>Tue, 10 Feb 2009 15:44:07 -0800</pubDate>
	<category>css</category>
	<category>div</category>
	<category>fixed</category>
	<category>float</category>
	<category>html</category>
	<category>layout</category>
	<category>webkit</category>
	<dc:creator>geos</dc:creator>
	</item>
	<item>
	<title>WebKit Javascript Woes</title>
	<link>http://ask.metafilter.com/47114/WebKit%2DJavascript%2DWoes</link>	
	<description>I&apos;m having a strange problem with WebKit&apos;s Javascript engine. Please help. Copious explanation inside. I have a live inline comment preview feature, much like MetaFilter&apos;s, on my blog. It works great in Opera and Firefox (and MSIE). However, it doesn&apos;t seem to work in Safari, OmniWeb, or even the WebKit nightly build-I downloaded it in the hope that this was a WebKit bug that&apos;s fixed upstream in the nightlies, but if it &lt;i&gt;is&lt;/i&gt; their bug, it doesn&apos;t look like it&apos;s been fixed. I&apos;m asking this question in the hope that it&apos;s something &lt;i&gt;I&lt;/i&gt; can fix.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Here&apos;s how my comment preview code works:&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
1. There&apos;s a textarea with the id &quot;comment-text&quot; which you type your comment into. It has an onKeyUp event handler that calls doCommentPreview() in my javascript file. There&apos;s a preview field underneath the textarea with the id &quot;comment-preview&quot;, which doCommentPreview() fills with the preview HTML.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
2. I have a blacklist of disallowed words, as a spam prevention measure. The comment engine will refuse any comment that contains any of these words or phrases.&lt;br&gt;
&lt;br&gt;
3. At the top of the document (not in the javascript file), I fill a javascript array called spams[] with the contents of the blacklist, using php, on the server side.&lt;br&gt;
&lt;br&gt;
4. I have two String prototype functions: showSpams() and regExEscape(). I use showSpams() to highlight items in the blacklist that a commenter might have typed in, to alert them right in the inline previewer that their comment is likely to be rejected before they hit post. It just tests the comment against each element of the spam[]array, and if the comments contains that particular word, it turns red and is surrounded by a border. &lt;br&gt;
&lt;br&gt;
5. I&apos;ve enabled the Debug menu using &lt;pre&gt;defaults write com.apple.Safari EnableDebugMenu 1&lt;/pre&gt; Safari&apos;s Javascript console, in the debug menu, shows the following error: &lt;pre&gt;Value undefined (result of expression re.compile) is not object. bloggie_05.js&lt;/pre&gt; on line 16.&lt;br&gt;
&lt;br&gt;
The line that WebKit complains about is the first line inside the for-loop in String.prototype.showSpams(): &lt;pre&gt;re.compile(spams[i].regExEscape(),&apos;gim&apos;);&lt;/pre&gt; 6. Here&apos;s all the code, in context:&lt;br&gt;
&lt;br&gt;
6-a. At the top of the document, in the &amp;lt;head&amp;gt; section: &lt;pre&gt;&amp;lt;script language=&quot;javascript&quot;&amp;gt;var spams = new Array();spams[0] = &apos;casino&apos;;spams[1] = &apos;craps&apos;;spams[2] = &apos;backgammon&apos;;spams[3] = &apos;cash advance&apos;;&amp;lt;/script&amp;gt;&lt;br&gt;
&amp;lt;script src=&quot;bloggie_05.js&quot;  language=&quot;javascript&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt; [I abbreviated the blacklist (the spams[] array) because this question is already way too long.]&lt;br&gt;
&lt;br&gt;
In the textarea used for writing comments, I have this: &lt;pre&gt;&amp;lt;textarea tabindex=&quot;1&quot;  id=&quot;comment-text&quot; name=&quot;comment_text_body&quot; style=&apos;width:95%;height:300px;&apos; onKeyUp=&quot;javascript:doCommentPreview();&quot;&amp;gt;&amp;lt;/textarea&amp;gt;&lt;/pre&gt; And here&apos;s the empty div underneath it, which is filled by the doCommentPreview() function above: &lt;pre&gt;&amp;lt;div class=&quot;ientrycomment_body&quot; id=&quot;comment-preview&quot; name=&quot;prevu&quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;/pre&gt; Finally, here&apos;s the code in the external (bloggie_05.js) javascript file: &lt;pre&gt;function doCommentPreview(doc){&lt;br&gt;
	doc=(typeof(doc)==&quot;undefined&quot;?document:doc);&lt;br&gt;
	field=doc.getElementById(&quot;comment-text&quot;);&lt;br&gt;
	preview_field=doc.getElementById(&quot;comment-preview&quot;);&lt;br&gt;
	preview_field.innerHTML = &quot;&amp;lt;p&amp;gt;&quot; + field.value.split(/\n\n/).join(&quot;&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&quot;).split(/\n/).join(&quot;&amp;lt;br /&amp;gt;&quot;).showSpams() + &quot;&amp;lt;/p&amp;gt;&quot;;&lt;br&gt;
}&lt;br&gt;
String.prototype.showSpams = function(){&lt;br&gt;
    despammed=this;&lt;br&gt;
    re = new RegExp();&lt;br&gt;
    for (var i=0; i &amp;lt; spams.length; i++) {&lt;br&gt;
        &lt;b&gt;re.compile(spams[i].regExEscape(),&apos;gim&apos;);&lt;/b&gt;&lt;br&gt;
        despammed=despammed.replace(re,&quot;&amp;lt;span style=\&quot;color:red;border:1px dotted;\&quot; title=\&quot;you can&apos;t say that here!\&quot;&amp;gt;&quot; + spams[i] + &quot;&amp;lt;/span&amp;gt;&quot;);&lt;br&gt;
    }&lt;br&gt;
    return despammed;&lt;br&gt;
}&lt;br&gt;
String.prototype.regExEscape = function() {&lt;br&gt;
  text=this;&lt;br&gt;
  if (!arguments.callee.sRE) {&lt;br&gt;
    var specials = [  &apos;/&apos;, &apos;.&apos;, &apos;*&apos;, &apos;+&apos;, &apos;?&apos;, &apos;|&apos;, &apos;(&apos;, &apos;)&apos;, &apos;[&apos;, &apos;]&apos;, &apos;{&apos;, &apos;}&apos;, &apos;\\&apos; ];&lt;br&gt;
    arguments.callee.sRE = new RegExp(&lt;br&gt;
      &apos;(\\&apos; + specials.join(&apos;|\\&apos;) + &apos;)&apos;, &apos;g&apos;&lt;br&gt;
    );&lt;br&gt;
  }&lt;br&gt;
  return text.replace(arguments.callee.sRE, &apos;\\$1&apos;);&lt;br&gt;
}&lt;/pre&gt;The line that WebKit has a problem with is in bold, in the String.prototype.showSpams() above.&lt;br&gt;
&lt;br&gt;
What&apos;s going on here?</description>
	<guid isPermaLink="false">tag:ask.metafilter.com,2006:site.47114</guid>
	<pubDate>Sat, 23 Sep 2006 13:26:46 -0800</pubDate>
	<category>apple</category>
	<category>javascript</category>
	<category>mac</category>
	<category>osx</category>
	<category>safari</category>
	<category>webkit</category>
	<dc:creator>evariste</dc:creator>
	</item>
	
	</channel>
</rss>

