thais-molica / css-template-layout

Automatically exported from code.google.com/p/css-template-layout
0 stars 0 forks source link

when html structure do not contain template but has css with template definition, el.slot errors out #10

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add html with no template struct 
2. Add a css or style with any template definitions but none used in the html 
3. Run the sample

What is the expected output? What do you see instead?
slot.el is undefined
error source line: [Break On This Error] if(!slot.el.parents().is(tpl_sel) && 
!slot.el.is(tpl_sel)) { 

What version of the product are you using? On what operating system?
1.1.6

Please provide any additional information below.
Issue is in getTemplateData(rules) .. 
var parents = $(p_sel).parents(); will return nothing because no template exist 
for this definition leading to cur_sel = false in the code below

// Get first template or nearest one
if(min_distance === false || distance < min_distance) {
min_distance = distance;
cur_sel = t_sel; 
} 

Original issue reported on code.google.com by emmanuel...@gmail.com on 24 May 2011 at 7:32

GoogleCodeExporter commented 9 years ago
I fixed the issue so thought i contribute it here.  Changes are on line 542, 
return nothing(empty object) if template isn't found in the html and line 1243 
- if template returned is an empty object, then template wasn't found in html, 
thus no need to call t.make() else call t.make(). Attach is the update file. 

Original comment by emmanuel...@gmail.com on 25 May 2011 at 4:27

Attachments: