In a Meteor application, I have this on the client side:
Meteor.startup(function() {
Deps.autorun(function () {
var p = Session.get("page");
if(!!Session.get(p)) {
_.map(pages, function(p) {
$("." + p).children().remove();
});
$("." + p).append(Session.get(p));
// Assign h2-link to h2's that contain an a
// to customize their appearance in CSS
$("a").parent("h2").addClass("h2-link");
}
});
});
The above code removes HTML from all dummy classes and appends a customized HTML snippet to the active one.
$("a").parent("h2").addClass("h2-link"); applies a custom style to h2s that contain a link.
Now, having defined h2-link in CSS to be .h2-link { border-bottom: 1px solid red; } works perfectly.
Doing it directly via $("a").parent("h2").css("border-bottom: 1px solid red;"); does not work.
Why doesn't it work when I try to apply styles directly on the DOM?
Does Meteor prohibit DOM-CSS-applications?