Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • M MathJax
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 304
    • Issues 304
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • MathJax
  • MathJax
  • Merge requests
  • !812

Adds wrapper

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/jamesplease/new-wrapper into master May 09, 2014
  • Overview 2
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: jamesplease

View the changes here

  • Wraps Mathjax in an IIFE
  • Throws an error when the browser isn't supported

Why?

This change gets rid of this line, which are two closing brackets that require users to go to the top of the file to see where they begin. Yikes. By wrapping things in an IIFE we can keep those two 'checks' where the belong – self-contained at the top of the file. It makes the code a bit more readable, I think.

On the error: emitting the error when the browser isn't supported is being more communicative than just silently failing. I think this is important enough of a failure to be error-worthy, but maybe you disagree and prefer the silent failure. Nbd either way.

Why an IIFE? For this PR it might not seem that necessary. It does let us return from the IIFE on the second conditional at the top, which is super nice, though. What's more important is the direction this can take the library. It's a small step toward supporting a UMD implementation, which could come next.

I admit I didn't test this. It's really just a PR to see if you guys are interested in these sorts of changes toward the broader goal of cleaning up the lib.

Note: Because I indented the whole file Github won't show the changes unless you tell it to ignore whitespaces.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/jamesplease/new-wrapper