Coder Social home page Coder Social logo

Comments (19)

alexandertrefz avatar alexandertrefz commented on May 3, 2024

+1

from meteor.

dgreensp avatar dgreensp commented on May 3, 2024

I see what you mean. However, we don't currently plan to have special support for IE conditional comments at the top level of the document.

from meteor.

badslug avatar badslug commented on May 3, 2024

How about just a hook to override the default tag text with our own arbitrary text? That would let us generate/inject the appropriate code we need without making it specific to IE conditional comments?

from meteor.

dgreensp avatar dgreensp commented on May 3, 2024

The HTML that's sent down to the browser on page load comes from a template in app/lib/app.html.in. The right hook would probably be to specify a different template for that.

You could hack your meteor distribution in the mean time, or there might be another way to achieve what you want. For example, conditional comments in the around stylesheets or script tags.

from meteor.

badslug avatar badslug commented on May 3, 2024

Thanks for the pointers. Are there general guidelines for how to make these hacks in a way that is "safe" or forward compatible with updates. My fear is that doing a hack of this kind will mean I will have to have a process for supporting meteor update. E.g. if I replace app/lib/app.html.in with a custom file, when I run meteor update I'm assuming that will get overwritten or will it? I have some developers that follow my meteor project and currently the workflow is simple: git pull, meteor update, meteor. I don't want the step after meteor update to be a long check list of file updates to support hacks if I can avoid it.

I hope this isn't being unreasonable. I really appreciate what meteor does already and I'm very eager to see frequent updates.

from meteor.

TaraRed avatar TaraRed commented on May 3, 2024

If you change to an approach where you can fetch the last commits from git instead of updating meteor, you will retain your changes and will be warned of any "conflicts" if the same line has been changed by both you and Meteor.

Note that you might be able to do something like $('body').addClass('ie'); instead, when the document is ready $(document).ready(function() { ... add the classes ... }. See QuirksMode on how to detect the browser...

It would even be awesome if somewhere were to add a smart package for this kind of stuff, as well as Modernzr.

from meteor.

badslug avatar badslug commented on May 3, 2024

Hi Tom, I was hoping to make our hacks less intrusive if possible and avoid maintaining a fork of meteor. Meteor is changing so quickly that maintaining a vendor branch seems a bit daunting.

Your suggestion for doing something dynamic with javascript using QuickrsMode and/or Modernizer is good validation for me. Because of this issue I've been looking at using javascript to adjust styles based on the browser - we had already been going down that road to support a non-javascript stylesheet (that basically hides everything and shows a "You must have javascript" message since our web app requires javascript). I think I'll pursue that route rather than trying to hack meteor itself. Although I still think there are valid use-cases for injecting code before and substituting for the tag.

I've also been thinking about switching to bootstrap since there is a smart package for it already.

I agree having a Modernzr smart package would be awesome. I've been putting off building any smart packages until the API is approved by meteor to use. The other smart package I've been really wanting (and would be more than willing to build once the API is ready) would be one for jquery mobile.

Anyway, thanks for the input.

from meteor.

TaraRed avatar TaraRed commented on May 3, 2024

Meteor simply does not work in any way if you don't have JS, I believe that it shows an empty page but I've seen there is an unsupported.html as well. I think it would do the former though, for people that don't have Javascript (not much do, I think).

Yeah, you could add the classes to the body or html tag and still continue to use the approach you did before.

from meteor.

badslug avatar badslug commented on May 3, 2024

Ya, meteor doesn't show anything without javascript enabled. I hadn't played with that yet. I guess at some point sooner than later I'll have to figure out how to override the blank page when javascript is disabled. We need to display some message there to explain they need javascript...

I would think that even meteor out of the box should display some sort of "You must have javascript enabled to use this web app" default rather than a completely blank page. Unsupported seems to be for older browsers rather than no javascript at all. I guess this is either something we wait for the meteor guys to address or fork, patch and submit a pull request. My laziness has made me put off any patching of meteor (hence this whole ticket and thread) - the meteor guys are covering ground so fast it seems that I just wait a week and they've patched a ton of the things that I would have tried to work on. On the other hand, they have kind of hit a lull in small patches as they work on the deeper security stuff right now... I must keep working on project and not get pulled into patching meteor...

from meteor.

its42 avatar its42 commented on May 3, 2024

+1

from meteor.

zeopix avatar zeopix commented on May 3, 2024

+1

from meteor.

nikolaygit avatar nikolaygit commented on May 3, 2024

+1

from meteor.

Lobosque avatar Lobosque commented on May 3, 2024

+1

from meteor.

chasingmaxwell avatar chasingmaxwell commented on May 3, 2024

+1

from meteor.

DominikGuzei avatar DominikGuzei commented on May 3, 2024

+1

from meteor.

awatson1978 avatar awatson1978 commented on May 3, 2024

Here's a pattern I commonly use for adding classes to the <html> tags.

Meteor.startup(function(){
  if(Meteor.userId()){
    removeWallpaper();
  }else{
    setWallpaper();
  }
});
setWallpaper = function(){
  $('html').addClass('landscapeLogin');
};
removeWallpaper = function(){
  $('html').removeClass('landscapeLogin');
};

And if you're using the event-hooks package, you can extend the pattern with the following.

Meteor.startup(function(){
  Hooks.init();

  Hooks.onLoggedIn = function(){
    removeWallpaper();
  };
  Hooks.onLoggedOut = function(userId){
    setWallpaper();
  };
});

This issue can be resolved with application code.

from meteor.

mquandalle avatar mquandalle commented on May 3, 2024

Fixed in e077e13 !

from meteor.

glasser avatar glasser commented on May 3, 2024

@mquandalle well, sort of. actually, this has existed (with an unofficial API which has changed a few times, currently WebApp.addHtmlAttributeHook) since 0.5.8. The commit you found is just a refactoring of which code implements it. (Whichever release this goes into (likely 0.8.1) will change the API a tiny bit again...)

from meteor.

kfatehi avatar kfatehi commented on May 3, 2024

Hi so I wanted to add Modernizr and had to figure this out. I ended up with this code, which is working.

Meteor.startup(function() {
  WebApp.addHtmlAttributeHook(function() {
    return {
      class: "no-js"
    }
  })
});

from meteor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.