ai2html icon indicating copy to clipboard operation
ai2html copied to clipboard

Namespace problematic when using multiple ai2html exports on one page

Open briantjacobs opened this issue 8 years ago • 3 comments

For classes like g-aiAbs or g-aiImg, as in, classes without the project_name, there's a danger that they'll collide with other ai2html exports on same page if the css is modified after the fact. It would be helpful if every class were fully namespaced with project_name, so each export can be self contained without danger of namespace collision.

html[1] += "\t\t\t."+nameSpace+"aiImg{\r";

to

html[1] += "\t\t\t."+nameSpace + makeKeyword(docSettings.project_name)+"aiImg{\r";

Alternatively, add a parent selector to the less specific classes

#g-project_name-box .g-aiAbs{
	position:absolute;
}

briantjacobs avatar Jun 12 '17 19:06 briantjacobs

Hi Brian,

This seems reasonable. I have one question -- is there a reason why you would want to redefine a simple style like .g-aiAbs by editing the CSS generated by ai2html? Wouldn't it be preferable to override a style in a particular document by applying the pattern in your second alternative, for example:

#g-project_name-box .g-aiAbs{
	visibility: hidden;
}

mbloch avatar Jun 12 '17 21:06 mbloch

Yeah that makes sense as a responsible way to apply an override for a particular export. But a few times I've run into cases where less css-savvy folks are making edits to an export and unaware that their changes are inadvertently affecting other graphics on a page. Better protected default styles would help protect people from themselves.

briantjacobs avatar Jun 12 '17 21:06 briantjacobs

Ok, I'm convinced, I'll adopt your second suggestion v. soon.

mbloch avatar Jun 14 '17 18:06 mbloch