<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>James Hopkins</title>
	<atom:link href="http://jhop.me/feed" rel="self" type="application/rss+xml" />
	<link>http://jhop.me</link>
	<description></description>
	<lastBuildDate>Sun, 06 Nov 2011 15:43:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Two major Views related bugs in Drupal 7</title>
		<link>http://jhop.me/drupal/two-major-views-related-bugs-in-drupal-7</link>
		<comments>http://jhop.me/drupal/two-major-views-related-bugs-in-drupal-7#comments</comments>
		<pubDate>Sun, 06 Nov 2011 15:43:56 +0000</pubDate>
		<dc:creator>James Hopkins</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Views]]></category>

		<guid isPermaLink="false">http://jhop.me/?p=1067</guid>
		<description><![CDATA[Whilst some might interpet the somewhat pessimistic RC1 status of Views 7.x-3.x as a bit of a turn-off, the module is actually pretty solid; from what I can remember, the upgrade path is the only thing stopping the module from advancing in maturity further, for the time being.
There are however, a couple of pretty major [...]]]></description>
			<content:encoded><![CDATA[<p>Whilst some might interpet the somewhat pessimistic RC1 status of Views 7.x-3.x as a bit of a turn-off, the module is actually pretty solid; from what I can remember, the upgrade path is the only thing stopping the module from advancing in maturity further, for the time being.</p>
<p>There are however, a couple of pretty major bugs that have come about from changes outside the module itself:</p>
<h2><a href="http://drupal.org/node/241570">Theme preprocess functions which attempt to add template suggestions, aren&#8217;t invoked</a></h2>
<p>I managed to find this bug pretty quickly, since it&#8217;s standard procedure from a theming perspective, to abstract processing logic from markup. It appears that the problem originates from a change to the theme registry, where you can&#8217;t specify template suggestions from a preprocess anymore, rather than traditionally invoking them from theme().</p>
<p>Barring actually patching core, there doesn&#8217;t seem to be an elegant solution for the time being. As an interim solution, I decided to use a preprocess function that doesn&#8217;t try to invoke a template suggestion (i.e <code>preprocess_views_view()</code>), and use a <code>switch()</code> to target individual Views.</p>
<h2><a href="http://drupal.org/node/1063418"><code>views_get_view_result()</code> doesn&#8217;t return Field API field values</a></h2>
<p>This is a pretty major issue; put simply, when using <code>views_get_view_result()</code> to return values from a View, values from any non-core fields won&#8217;t be rendered.</p>
]]></content:encoded>
			<wfw:commentRss>http://jhop.me/drupal/two-major-views-related-bugs-in-drupal-7/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exporting block positioning into code in Drupal</title>
		<link>http://jhop.me/uncategorized/exporting-block-positioning-into-code-in-drupal</link>
		<comments>http://jhop.me/uncategorized/exporting-block-positioning-into-code-in-drupal#comments</comments>
		<pubDate>Sun, 18 Sep 2011 16:56:45 +0000</pubDate>
		<dc:creator>James Hopkins</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jhop.me/?p=1055</guid>
		<description><![CDATA[On most occasions, exporting configuration settings in code can be managed by the Features module, however, there are some scenarios where it can&#8217;t handle particular requirements. One particular instance, in my experience, is exporting block positioning (in relation to theme regions).
Fortunately, the block module gives us the hook_block_info_alter function that allows us to specify the [...]]]></description>
			<content:encoded><![CDATA[<p>On most occasions, exporting configuration settings in code can be managed by the <a href="http://drupal.org/project/features">Features</a> module, however, there are some scenarios where it can&#8217;t handle particular requirements. One particular instance, in my experience, is exporting block positioning (in relation to theme regions).</p>
<p>Fortunately, the block module gives us the <code>hook_block_info_alter</code> function that allows us to specify the region to which a certain should be placed. Since one of the function&#8217;s parameters is the <code>$theme</code> variable (formatted as a string), it allows us to specify block-to-region placement on a per-theme basis. An example of a block position export would be:</p>
<pre><code>function hook_block_info_alter(&amp;$blocks, $theme, $code_blocks) {
  if($theme == THEMENAME) {
    $blocks['search']['form']['region'] = 'header';
    $blocks['search']['form']['status'] = 1;
  }
}
</code></pre>
<h2>Importance of exporting block positioning in Drupal 7</h2>
<p>You&#8217;ll notice from code above, that I&#8217;ve used the search block as an example.</p>
<p>One of the theming-related changes that Drupal 7 introduces is that the <a href="http://drupal.org/node/254940#search_box">rendered output of the search box is no longer available as the <code>$search_box</code> variable</a> in the theme, as it once was in Drupal 6. Instead, the search form is incorporated into the block system, meaning that its position should be controlled via this mechanism.</p>
]]></content:encoded>
			<wfw:commentRss>http://jhop.me/uncategorized/exporting-block-positioning-into-code-in-drupal/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manipulating the response from Drupal Views&#8217; AJAX mechanism</title>
		<link>http://jhop.me/drupal/manipulating-the-response-from-drupal-views-ajax-mechanism</link>
		<comments>http://jhop.me/drupal/manipulating-the-response-from-drupal-views-ajax-mechanism#comments</comments>
		<pubDate>Thu, 14 Jul 2011 17:54:21 +0000</pubDate>
		<dc:creator>James Hopkins</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[drupal 7]]></category>

		<guid isPermaLink="false">http://jhop.me/?p=1052</guid>
		<description><![CDATA[When there is a requirement to plug any sort of AJAX-y mechanism into your Views, I always find it&#8217;s advantageous to create the functionality from scratch, utilising hook_menu (including 'type' =&#62; MENU_CALLBACK), or using the Services module, to estabish the RESTful service(s). However, there are occasions when using Views&#8217; built-in AJAX mechanism (&#8216;Use AJAX&#8217;) is [...]]]></description>
			<content:encoded><![CDATA[<p>When there is a requirement to plug any sort of AJAX-y mechanism into your Views, I always find it&#8217;s advantageous to create the functionality from scratch, utilising <code>hook_menu</code> (including <code>'type' =&gt; MENU_CALLBACK</code>), or using the Services module, to estabish the RESTful service(s). However, there are occasions when using Views&#8217; built-in AJAX mechanism (&#8216;Use AJAX&#8217;) is a prequisite for what you&#8217;re trying to achieve. The immediate assumption is that this technique wouldn&#8217;t give you enough granularity and control over response output. This is in fact incorrect, as the response can be interecepted relatively easily.</p>
<h2>Case study</h2>
<p>I recently needed to create a block-display View that incorporates an exposed filter (filtering on taxonomy term). As <a href="http://drupal.org/node/288101#comment-939928">merlinofchaos points out</a>, exposed filters make GET requests in order to return responses, and they can&#8217;t do so without the AJAX option turned on. Turning on the AJAX option makes the filters appear &#8211; and better still, makes them work &#8211; but out of the box, a subsequent data response will simply replace the current data response that&#8217;s already in the DOM (using JQuery&#8217;s <code>replaceWith</code>). I&#8217;d like to have full control of the response, like I would do if I was to construct the AJAX functionality from scratch.</p>
<h2>A how-to guide</h2>
<p>Subsequent to my own findings, I <a href="http://mah.moud.info/changing-views-ajax-response-drupal-6">found an article</a> that details the same method pretty well, although I feel it does miss out a few key points.</p>
<p>Views allows us to intercept the response using <code>hook_ajax_data_alter</code> (implemented on line 79 of <code>views/includes/ajax.inc</code>), which is a hook originating from <code>drupal_alter</code>.  If you check on line 77 of the same file, you&#8217;ll see that out of the box, Views already establishes a callback (<code>Drupal.Views.Ajax.ajaxViewResponse</code>) that can be parsed into javascript as an object method. However, this method will apply to <strong>all</strong> Views that use the built-in &#8216;Use AJAX&#8217; option. In most cases, this isn&#8217;t preferential since if you&#8217;re wanting to manipulate the response data, you&#8217;ll want to do it on a per-View basis.</p>
<p>In order to establish a callback on a per-View basis, we need to extract details of the view from the <code>$view</code> object specified in the hook callback, with the objective being to specify a specific callback for each View display. Since <code>hook_ajax_data_alter</code> is a non-persistent function (it&#8217;s only called right before the response data is sent through any javascript callbacks), on the surface it&#8217;s difficult to debug using conventional means. Fortunately,  Watchdog can help here (albeit, tediously). Inside the <code>$view</code> object, you can determine the view name (<code>$view-&gt;ajax_path[1]['view_name']</code>) and display (<code>$view-&gt;ajax_path[1]['view_display_id']</code>), which when used together, can construct an appropriate <code>if()</code> statement, like the following:</p>
<pre><code>function hook_ajax_data_alter(&amp;$object, $module, $view) {
	/*
	 * Overwrite the 'Drupal.Views.Ajax.ajaxViewResponse' callback that's in Views core
	 * as we don't want both callbacks running concurrently.
	 */

	$view_details = $view-&gt;ajax_path[1];

	if ($view_details['view_name'] == 'viewName' &amp;&amp; $view_details['view_display_id'] == 'viewId'){
	 $object-&gt;__callbacks = array('Drupal.moduleName.methodName');
	}

}
</code></pre>
<p>You&#8217;ll notice that I&#8217;ve added a comment which explains that I&#8217;m choosing to override the default <code>Drupal.Views.Ajax.ajaxViewResponse<br />
</code> callback method by writing the <code>__callbacks </code> array key value explicitly. Obviously, you can use multiple callbacks (including the default one), if you wish.</p>
<p>And that should work!</p>
]]></content:encoded>
			<wfw:commentRss>http://jhop.me/drupal/manipulating-the-response-from-drupal-views-ajax-mechanism/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running Drupal 7 on shared hosting</title>
		<link>http://jhop.me/drupal/running-drupal-7-on-shared-hosting</link>
		<comments>http://jhop.me/drupal/running-drupal-7-on-shared-hosting#comments</comments>
		<pubDate>Thu, 30 Jun 2011 21:38:23 +0000</pubDate>
		<dc:creator>James Hopkins</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[drupal 7]]></category>

		<guid isPermaLink="false">http://jhop.me/?p=1043</guid>
		<description><![CDATA[As I&#8217;ve recently disovered to my cost, a pretty bog-standard Drupal 7 install doesn&#8217;t play nice with a shared hosting package I&#8217;m using &#8211; and it doesn&#8217;t appear I&#8217;m alone in the situation I find myself in.
I&#8217;ve used Drupal 6 for my last 5-6 jobs (on many different types of large-scale hosting environments), as well [...]]]></description>
			<content:encoded><![CDATA[<p>As I&#8217;ve recently disovered to my cost, a pretty bog-standard Drupal 7 install doesn&#8217;t play nice with a shared hosting package I&#8217;m using &#8211; and <a rel="nofollow" href="http://drupal.org/node/1020494">it doesn&#8217;t appear I&#8217;m alone in the situation I find myself in</a>.</p>
<p>I&#8217;ve used Drupal 6 for my last 5-6 jobs (on many different types of large-scale hosting environments), as well as many freelance projects that are predominantly hosted on shared environments. Load times for the latter (with Drupal cache_page enabled) were surprisinly impressive. I recently undertook a re-design of my Mum&#8217;s (who practices <a title="Counsellor in Surrey" href="http://www.alisonhopkinscounselling.co.uk/">counselling in Surrey</a>, UK) site, and decided to give Drupal 7 a go, after reading some of the theming improvements. However, load times were extremely poor; around 2-3 second page generation, and 2 seconds through cache_page. But surely you could use a caching module to improve performance, no?</p>
<h2>The <a rel="nofollow" href="http://drupal.org/project/boost">Boost module</a></h2>
<p>I&#8217;ve used <a rel="nofollow" href="http://drupal.org/project/boost">Boost</a> a couple of times before when embarking on freelance projects. I can categorically say, that apart from the modules for D6 that have since made core in D7 (<a rel="nofollow" href="http://drupal.org/project/cck">CCK</a>, <a rel="nofollow" href="http://drupal.org/project/imagecache">image cache</a>, etc), it&#8217;s one of the most useful modules available. Essentially, it supersedes the core Drupal cache_page mechanism, by bypassing the need for PHP processing and associated database calls altogether, by caching page requests into static HTML files (gzip&#8217;ped versions are also generated for browsers that support <code>gunzip</code>). Requests are served purely through mod_rewrite (Drupal clean URLs is a prerequisite for the module), meaning that anonymous users are served static files.</p>
<p>One really useful feature of the D6 version of Boost, is that it incorporates it&#8217;s own crawler, giving you the ability to preemptively cache pages in your <code>url_alias</code> table on cron jobs. The issues with the Drupal 7 version, is that it doesn&#8217;t include a crawler, meaning that unless you <a href="http://drupal.org/node/1074080#comment-4142888">hack a makeshift script</a>, then you&#8217;re reliant on anonoymous users hitting your pages, thus invoking Boost&#8217;s caching mechanism. This wouldn&#8217;t be such an issue if load times weren&#8217;t so hideous, but I&#8217;m simply not prepared for any user to wait around 2 seconds per page load.</p>
<p>Of course, my mother could invest in a small-scale VPS, but I&#8217;m of the opinion that version releases of a CMS shouldn&#8217;t dictate the specification of the environments they can run on. Drupal has of course got a lot more enterprise-level exposure recently, and that&#8217;s no doubt a good thing, but it needs to remain a viable solution for small-scale sites too.</p>
]]></content:encoded>
			<wfw:commentRss>http://jhop.me/drupal/running-drupal-7-on-shared-hosting/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clear &#8216;cache_page&#8217; once new node comment has been saved in Drupal 7</title>
		<link>http://jhop.me/drupal/clear-cache_page-once-new-node-comment-has-been-saved-in-drupal-7</link>
		<comments>http://jhop.me/drupal/clear-cache_page-once-new-node-comment-has-been-saved-in-drupal-7#comments</comments>
		<pubDate>Mon, 30 May 2011 15:46:23 +0000</pubDate>
		<dc:creator>James Hopkins</dc:creator>
				<category><![CDATA[Drupal]]></category>

		<guid isPermaLink="false">http://jhop.me/?p=1038</guid>
		<description><![CDATA[Slightly surprised this hasn&#8217;t been covered anywhere before. Building upon the answer to a similar problem in Drupal 5, I thought it would be beneficial to post how to achieve the same thing in Drupal 7.
Since hook_comment is now unavailable in Drupal 7 (in favour of some more explicit interception-based hooks), I&#8217;ve decided to utilise [...]]]></description>
			<content:encoded><![CDATA[<p>Slightly surprised this hasn&#8217;t been covered anywhere before. Building upon the <a rel="nofollow" href="http://www.seo-expert-blog.com/blog/clearing-drupals-page-cache-after-adding-comments">answer to a similar problem in Drupal 5</a>, I thought it would be beneficial to post how to achieve the same thing in Drupal 7.</p>
<p>Since <code><a href="http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_comment/6">hook_comment</a></code> is now unavailable in Drupal 7 (in favour of some more <a href="http://api.drupal.org/api/drupal/includes--module.inc/group/hooks">explicit interception-based hooks</a>), I&#8217;ve decided to utilise <code>hook_comment_insert</code> for this purpose. Together with a revised <code>url()</code> syntax, the hook looks as follows:</p>
<p><code>function hook_comment_insert($comment) {<br />
	// Clear page-specific cache after comment has been saved for that page<br />
	$url = url('node/' . $comment->nid, array('absolute' => TRUE));<br />
  cache_clear_all($url, 'cache_page');<br />
}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://jhop.me/drupal/clear-cache_page-once-new-node-comment-has-been-saved-in-drupal-7/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An apology</title>
		<link>http://jhop.me/browsers/ie8/an-apology</link>
		<comments>http://jhop.me/browsers/ie8/an-apology#comments</comments>
		<pubDate>Wed, 28 Apr 2010 22:49:20 +0000</pubDate>
		<dc:creator>James Hopkins</dc:creator>
				<category><![CDATA[IE8]]></category>
		<category><![CDATA[IE9]]></category>

		<guid isPermaLink="false">http://jhop.me/?p=1035</guid>
		<description><![CDATA[I&#8217;d like to apologise to those who have taken the time to contact me (either by email or Twitter) regarding IE8 bugs
A few months ago, I embarked on a work project that has ultimately left me with no time to keep on top of incoming mails, let alone bug reports from contributors. If you haven&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d like to apologise to those who have taken the time to contact me (either by email or Twitter) regarding IE8 bugs</p>
<p>A few months ago, I embarked on a work project that has ultimately left me with no time to keep on top of incoming mails, let alone bug reports from contributors. If you haven&#8217;t received a reply from me regarding your correspondence, then I could easily see how you may think I can&#8217;t be bothered to reply &#8211; rest assured, this isn&#8217;t the case at all.</p>
<p>I&#8217;ve had a truly great response from authors ever since I requested they write in about potential bugs they&#8217;ve found. For me to not respond to the more recent emails in an adequate time frame is completely unprofessional and I apologise profusely for this. I still have a complete archive of all emails sent to me, and I endeavour to respond appropriately to all of these in the coming month.</p>
<p>Some people may argue that since IE9 is now starting to be exposed publicly, that maintaining an IE8 bug list such as mine is worthless. I disagree strongly with this view. I like to think the list in it&#8217;s current form is providing developers with a much needed knowledge base that Microsoft Connect is lacking (filtering, clear UI, etc). My aim is to carry on maintaining the list into the near future, and for it to become a permanent resource to developers.</p>
<h2>IE9, and associated bug reporting</h2>
<p>Apart from reading the majority of IEBlog articles on IE9&#8217;s rendering capabilities, I&#8217;ve been completely out of the loop as to what IE9 has in store for developers when it&#8217;s finally released. You may be wondering, since I&#8217;m an IE MVP, why I wasn&#8217;t informed on a product group level; I don&#8217;t have an answer for you. There&#8217;s been absolutely <strong>no</strong> <acronym title="Product group invites">PGI</acronym>s for Internet Explorer and the IE MVP newsgroup has been extremely quiet- so quiet in fact I&#8217;ve now removed <a href="http://www.panic.com/unison/">Unison</a> from opening at startup, and I now don&#8217;t pay attention to the newsgroups at all.</p>
<p>I for one was astounded after finding out that IE9 won&#8217;t be released for WIndows XP &#8211; limiting a browser version to certain platform versions is absurd on so many different levels. I do all my browser testing on my Macbook Pro and I have two VM&#8217;s installed (one for IE6/7, and one for IE8). I&#8217;ve decided to bit the bullet and purchase Windows 7 tomorrow so that I can test drive IE9 for the first time, albeit on &#8216;Platform Preview&#8217;. </p>
<p>In terms of IE9 bug testing, like with IE8, my aim is to create an initial list and would open up participation to authors that are inclined to do so. I see a far greater need to establish a prominent list of IE9 issues than with IE8, since IE9 attempts to include complete implementations of several CSS3 modules, that they haven&#8217;t embarked on before with IE8. For this reason, I can evisage there being far more bugs with IE9 than with IE8.</p>
<p>Coming back to outstanding IE8 bug reports from authors writing in to me, I envisage to respond appropriately to those in the next month or so, and to continue to invite authors to contribute to this ever-growing list.</p>
]]></content:encoded>
			<wfw:commentRss>http://jhop.me/browsers/ie8/an-apology/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IE9 is coming</title>
		<link>http://jhop.me/browsers/ie9/ie9-is-coming</link>
		<comments>http://jhop.me/browsers/ie9/ie9-is-coming#comments</comments>
		<pubDate>Wed, 17 Feb 2010 20:54:17 +0000</pubDate>
		<dc:creator>James Hopkins</dc:creator>
				<category><![CDATA[IE9]]></category>

		<guid isPermaLink="false">http://jhop.me/?p=1010</guid>
		<description><![CDATA[All active bug tickets on Microsoft Connect have now been marked as postponed, and Microsoft have appended the following message to all of them:

Thank you for submitting your feedback on Internet Explorer 8.  The information in this bug has been reviewed carefully by the team and will help inform future releases of Internet Explorer. [...]]]></description>
			<content:encoded><![CDATA[<p>All active bug tickets on Microsoft Connect have now been marked as postponed, and Microsoft have appended the following message to all of them:</p>
<blockquote><p>
Thank you for submitting your feedback on Internet Explorer 8.  The information in this bug has been reviewed carefully by the team and will help inform future releases of Internet Explorer.  We are now closing down the Internet Explorer 8 Feedback Program in preparation for soliciting feedback for our next version and as such, per the Microsoft Connect guidelines, all remaining bugs for IE8 will be resolved as “Postponed” for now.  When the feedback program for the next release is ready, we will look at transferring this bug, along with any applicable status update.
</p></blockquote>
<p>I would certainly take this as a sign that the release of IE9 is approaching. To close the bug reporting system relating to a current browser version for any significant period of time, without a new version (reporting system or browser) being released soon after, would be ludicrous. On the other hand, it does make sense to transfer all bug reports for IE8 over to the reporting system for IE9, and by Microsoft doing this, it confirms there&#8217;ll be no interim browser versions, anyway. Hopefully Microsoft will open up IE9&#8217;s reporting system soon, as I currently don&#8217;t have anywhere to create new tickets!</p>
<p>This status message from Microsoft also ties in nicely with the upcoming date of <a href="http://www.microsoft.com/events/mix/default.aspx">MIX 2010</a> where it&#8217;s been confirmed that <a href="http://live.visitmix.com/News/Internet-Explorer-9-at-MIX10">Dean Hachamovitch will be discussing the development of IE9</a>. Dare I suggest that Microsoft will give us a definitive release date for IE9, or even better, release it there and then? If it&#8217;s not the latter, I&#8217;d hazard a guess that we&#8217;ll see a beta release within the next five months.</p>
]]></content:encoded>
			<wfw:commentRss>http://jhop.me/browsers/ie9/ie9-is-coming/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Selecting text within an element in CSS</title>
		<link>http://jhop.me/uncategorized/selecting-text-within-an-element-in-css</link>
		<comments>http://jhop.me/uncategorized/selecting-text-within-an-element-in-css#comments</comments>
		<pubDate>Thu, 07 Jan 2010 14:25:08 +0000</pubDate>
		<dc:creator>James Hopkins</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jhop.me/?p=975</guid>
		<description><![CDATA[An interesting discussion (which established itself as a branch from discussing behavioral characteristics of overflow) is currently taking place on www-style regarding a text selector control. Much of the detail is still being fleshed out, but I thought I&#8217;d give a quick overview.
Initially discussed as a possible way to remove suppress whitespace textnodes between inline-blocks, [...]]]></description>
			<content:encoded><![CDATA[<p>An interesting discussion (which established itself as a branch from <a href="http://lists.w3.org/Archives/Public/www-style/2009Dec/thread.html#msg326">discussing behavioral characteristics of <code>overflow</code></a>) is <a href="http://lists.w3.org/Archives/Public/www-style/2010Jan/thread.html#msg16">currently taking place on www-style regarding a text selector control</a>. Much of the detail is still being fleshed out, but I thought I&#8217;d give a quick overview.</p>
<p>Initially discussed as a possible way to remove suppress whitespace textnodes between <code>inline-block</code>s, the control itself would take the form of a pseudo element incorporating function notation taking a matching pattern as an argument &#8211; something along the lines of <code>::text(<span style="font-style: italic; font-weight: normal; white-space: nowrap;">matching-pattern</span>)</code> &#8211; which would have the ability to match strings of text within an element.</p>
<p>In contrast to my own confused ramblings (which I subsequently retracted), the consensus now is that the pseudo element should be excluded from crossing element boundaries in order to match a constituent of the argument, which means the full range of CSS layout properties can be exposed to the pseudo element (dependant on <acronym title="Document Object Model">DOM</acronym>-based pattern matching). Otherwise, consider Tab&#8217;s example:</p>
<pre><code>p::text("foo b"){ display:block; }
&lt;p&gt;foo &lt;span&gt;bar&lt;/span&gt; baz&lt;/p&gt;
</code></pre>
<p>The above would split the pseudo element in two, since part of it would cross into the <code>&lt;span&gt;</code> in order to match the pattern given as the argument, resulting in:</p>
<pre><code>&lt;p&gt;&lt;text match="foo b"&gt;foo &lt;/text&gt;&lt;i&gt;&lt;text match="foo b"&gt;b&lt;/text&gt;ar&lt;/i&gt; baz&lt;/p&gt;
</code></pre>
<p>Not only would this be quite-rightly unintuitive from an author&#8217;s perspective, but it would also be harder to implement (compared to excluding element boundary crossing) from a vendor point of view. Having said that, the former issue could be solved by providing a limited range of CSS properties, similar to that of <code>::first-line</code>, although conversation is veering away from such a resolution.</p>
<p>The sub-topic of discussion at the moment is how to avoid one ::text() boundary from crossing another.</p>
<p>If you can take some time out of your day, it&#8217;s certainly <a href="http://lists.w3.org/Archives/Public/www-style/2010Jan/thread.html#msg16">an interesting read</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jhop.me/uncategorized/selecting-text-within-an-element-in-css/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Establishing a new method of float containment</title>
		<link>http://jhop.me/css/css3/establishing-a-new-method-of-child-float-containment</link>
		<comments>http://jhop.me/css/css3/establishing-a-new-method-of-child-float-containment#comments</comments>
		<pubDate>Tue, 05 Jan 2010 18:51:18 +0000</pubDate>
		<dc:creator>James Hopkins</dc:creator>
				<category><![CDATA[CSS3]]></category>

		<guid isPermaLink="false">http://jhop.me/?p=916</guid>
		<description><![CDATA[So, in the many years in which floating (itself a workaround due to a lack of a more sanctioned layout tool) has become an integral part of CSS layouts, we have still not been provided with a control, whose primary purpose is float containment.
Authors have become reliant on either replicating a clearing markup element using [...]]]></description>
			<content:encoded><![CDATA[<p>So, in the many years in which <code>float</code>ing (itself a workaround due to a lack of a more sanctioned layout tool) has become an integral part of CSS layouts, we have <strong>still</strong> not been provided with a control, whose primary purpose is float containment.</p>
<p>Authors have become reliant on either <a href="http://www.positioniseverything.net/easyclearing.html">replicating a clearing markup element using generated content</a> (borne from <strong>author findings</strong>), or have found that <code><span>overflow:</span>hidden|scroll|auto;</code> applied to the parent, expands the parent&#8217;s margin-box to encapsulate the height of the child(ren). In fact, any property/value pair that can establish a new <a href="http://www.w3.org/TR/CSS21/visuren.html#block-formatting">block formatting context (BFC)</a> has the ability to do this. These pairs include:</p>
<ul>
<li><code><span>float:</span>left|right</code></li>
<li><code><span>position:</span>absolute|fixed</code></li>
<li><code><span>display:</span>inline-block|table-cell|table-caption</code></li>
<li><code><span>overflow:</span>hidden|scroll|auto</code></li>
</ul>
<p>Although there are a couple of areas in the spec that detail behavioral characteristics of <acronym title="Block Formatting Context">BFC</acronym>s, the crucial containment behavior can be derived from the <a href="http://www.w3.org/TR/2009/CR-CSS2-20090908/visuren.html#floats">Float specification</a></p>
<blockquote><p>[...] an element in the normal flow that establishes a new block formatting context (such as an element with &#8216;overflow&#8217; other than &#8216;visible&#8217;) must not overlap any floats in the same block formatting context as the element itself. If necessary, implementations should clear the said element by placing it below any preceding floats, but may place it adjacent to such floats if there is sufficient space.
</p>
<p><cite><a href="http://www.w3.org/TR/2009/CR-CSS2-20090908/visuren.html#floats">9.5 Floats</a></cite></p></blockquote>
<h2>A host of potential candidates</h2>
<p>Whilst the aforementioned properties are all able to clear child floats, there is a major difference with one property/value pair in particular in the way that it computes an element&#8217;s width.</p>
<p>Every property/value pair that has the ability to establish a <acronym title="Block Formatting Context">BFC</acronym> &#8211; apart from <code><span>overflow:</span>hidden|scroll|auto</code> &#8211; irrecoverably alters a block box&#8217;s computed width by applying the &#8217;shrink-to-fit&#8217; algorithm. In theory, we could try to emulate the expand-to-fit computed width of an in-flow block box with something like:</p>
<pre><code>display:inline-block; /* Establish a new BFC, but that applies shrink-to-fit to computed width */
   width:100%;
   box-sizing:border-box;
}
</code></pre>
<p>Whilst this would be a plausible solution in the presence of any horizontal padding values, horizontal margins would remain an issue, which leaves <code>overflow</code> as being the only real solution.</p>
<h2>Exploiting a property for it&#8217;s side-effect</h2>
<p>Since we&#8217;re hacking a property purely for the purposes of harnessing a side-effect of it&#8217;s BFC-establishing characteristic, we have to contend with it&#8217;s primary purpose; controlling the clipping of an element&#8217;s content when it overflows that element&#8217;s content box.</p>
<p>In the common case where an element (which has a floated sibling) overflows it&#8217;s parent and the parent is established as the containing block, one of the overflow mechanisms will be invoked; this is a problem if you require the overflowing content of the containing block to remain visible. The only solution in this case is to &#8216;revert&#8217; to one of the more traditional workarounds involving placing a clearing pseudo element after the parent&#8217;s document tree content. However, this author-invented solution acquires the pseudo element and means it can&#8217;t be used for more appropriate presentational purposes.</p>
<h2>What&#8217;s needed</h2>
<p>The crux of the matter is this &#8211; we&#8217;re being forced to use hacks in order to contain floats. Whilst <code>float</code> is an arguably adequate layout model for controlling content position amongst siblings (images, text, etc), it&#8217;s inadequate as a fundamental layout mechanism.</p>
<p>We&#8217;ve already identified that one particular characteristic of a <acronym title="Block Formatting Contexts">BFC</acronym> is that it contains floats in the manner that we require, each of the properties also have their own primary behavioral characteristics. So what I think&#8217;s needed is a new control which has the primary purpose of float containment in the same manner as a <acronym title="Block Formatting Context">BFC</acronym> currently does:</p>
<pre><code><span>'float-contain'</span>
<em>Value:</em>       auto | contain
<em>Initial:</em>     auto
<em>Applies to:</em>  non-replaced block-level elements
<em>Inherited:</em>   no
</code></pre>
<p>Granted, there are modules in the pipeline that will supersede <code>float</code> as a layout tool, but these are all still Working Drafts and likely to remain as drafts for a while longer (as far as I know). However, establishing a control that can be used as an interim solution whilst we still have to use floats, would be advantageous.</p>
<p class="notes">You can follow the discussion on www-style <a href="http://lists.w3.org/Archives/Public/www-style/2009Dec/thread.html#msg326">here</a> (NOTE: the thread spans multiple months)</p>
]]></content:encoded>
			<wfw:commentRss>http://jhop.me/css/css3/establishing-a-new-method-of-child-float-containment/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Bring back float-displace</title>
		<link>http://jhop.me/css/css3/bring-back-float-displace</link>
		<comments>http://jhop.me/css/css3/bring-back-float-displace#comments</comments>
		<pubDate>Tue, 29 Dec 2009 17:39:54 +0000</pubDate>
		<dc:creator>James Hopkins</dc:creator>
				<category><![CDATA[CSS3]]></category>

		<guid isPermaLink="false">http://jhop.me/?p=897</guid>
		<description><![CDATA[Although I was already aware of this property&#8217;s existence, I was unaware that it had been removed from later iterations of css3-box &#8211; that was, until the related issue was brought up recently on www-style.
To me, float-displace is another good example of a property (another being box-sizing) introduced in CSS3 that aims to &#8216;patch&#8217; a [...]]]></description>
			<content:encoded><![CDATA[<p>Although I was already aware of <a href="http://www.w3.org/TR/2002/WD-css3-box-20021024/#the-float-displace">this property</a>&#8217;s existence, I was unaware that it had been removed from later iterations of <a title="current version" href="http://www.w3.org/TR/css3-box/">css3-box</a> &#8211; that was, until the <a href="http://lists.w3.org/Archives/Public/www-style/2009Dec/0303.html">related issue was brought up recently</a> on <a href="http://lists.w3.org/Archives/Public/www-style/">www-style</a>.</p>
<p>To me, <code><a href="http://www.w3.org/TR/2002/WD-css3-box-20021024/#the-float-displace">float-displace</a></code> is another good example of a property (another being <code><a href="/css/css3/the-css3-box-sizing-concept-a-solution-to-a-longstanding-problem">box-sizing</a></code>) introduced in CSS3 that aims to &#8216;patch&#8217; a logical failing present in previous CSS revisisons. The current behavior can be described as, the indented edge (caused by a <code>margin</code> value) of the in-flow element isn&#8217;t preserved between the margin-edge of the float and the content-edge of the in-flow element; this creates the following pit-falls:-</p>
<ol>
<li>It&#8217;s completely counter-intuitive for authors who aren&#8217;t already aware of this limitation</li>
<li>The only real workaround to this limitation is to apply a <code>margin</code> value (which equals the indentation of the in-flow element) to the floated element, thus emulating this indentation.
</li>
</ol>
<p>From an author&#8217;s perspective, it&#8217;s perfectly acceptable to assume that the indented egde of the in-flow element will be preserved upon encountering a float.</p>
<p>I have no idea what the reasoning behind removing this property from the current revision was, but am keen to find out.</p>
]]></content:encoded>
			<wfw:commentRss>http://jhop.me/css/css3/bring-back-float-displace/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.359 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-02-04 05:57:19 -->

