Does anyone else work this way? 6

Posted by Peter Morris Sat, 20 Feb 2010 07:11:00 GMT

 

It is just after 7am on Saturday morning and I have just completed the most intense half an hours work of my day. When I finished, I opened my eyes and turned over in bed with a smile.

I had woken up at some point after 6am and before I opened my eyes I was thinking.

This post is about two things, the first is how I work, the second is a particular problem in the application I am working on for my current client.

How I Work

That 20 minutes to half an hour of pure mental time before I even open my eyes, sometimes I am sure before I even fully wake up, is often where the real inspiration happens. The rest of the days work is often defined as simply realising in code, the ideas and principles I worked out during that time. To me, that time is integral to what my clients pay for, that time can be more valuable by far than any single block of time in the whole of the rest of the day.

Application Problem - Web Page Printing

I am working on a CMS the moment, and one of the issues I have is how to define the parts of the page that are to be displayed when you select to print the page. Or, more accurately, how to hide the parts of the page not to be printed.

The CMS that I am working to replace did not encounter this problem. In that CMS the page templates are hard coded by developers, so at design time they know which sections of the page should be visible and which not, but in the new version, the user has full control over the page layout, so the system has to infer the visibility information.

I have been battering against this issue for a little over a week, on and off. Each morning as I drift up from slumber, I try to work out a way of sorting out which parts of the page are to be displayed. This morning, I realised it is not a case of deciding which sections of the page to display, but of which sections of the page to HIDE. Until this morning, I was not getting very far. The problem seemed to be that if you assert 'display: none;' against a dom element, none of its child elements are traversed, so even if they are marked as 'display: block;', they don't get a look in. This means that the styling to hide sections has to ride at the tips of the tree, or at least, has to be defined by knowledge of more than just the immediate node that is being rendered.

The problem is, that the issue can be very easily expressed if only two new css selector mechanisms existed.

has child

we all know what

div p

selects, but what I want to do is select the DIV if it has a P.

maybe

p ? div

That way, I can select a parent element if its child has a class of 'printable', any child.

not

Once I have 'has child', adding 'not' gives me the capability to hide any div that does not have a child that has a class of printable.

back to the real world

But, we don't have these selectors, and probably never will, so how to fake it? And that has been the subject of my thoughts this morning. The basics are sorted out, the principles defined, now, I have to spend some time actually implementing the ideas. Wish me luck.

  1. jeelgqquqo 25 days later:
  2. olena 27 days later:
    car insurance quotes rslqd life insurance 182559 home insurance =OO health insurance 644
  3. espotcatcon 27 days later:
    auto insurance quotes 8-PP cheap auto insurance =-]]] cheap health insurance 2295 home insurance quotes 77183
  4. 14 29 days later:
    life insurance quotes ethzs health insurance 05659 home insurance quotes >:-(
  5. brennan 29 days later:
    cheap auto insurance 7493 cheap health insurance 070110 cheap home insurance bjrcjc
  6. elektr1 about 1 month later:
    cheap auto insurance >:-(( life insurance :-PPP homeowners insurance uvawle life insurance quotes iipx