{"action":"created","comment":{"url":"https://api.github.com/repos/mapbox/mapbox.js/pulls/comments/50481466","id":50481466,"diff_hunk":"@@ -0,0 +1,100 @@\n+'use strict';\n+\n+var util = require('./util');\n+var format_url = require('./format_url');\n+var request = require('./request');\n+\n+var StyleLayer = L.TileLayer.extend({\n+    includes: [require('./load_tilejson')],\n+\n+    options: {\n+        sanitizer: require('sanitize-caja')\n+    },\n+\n+    initialize: function(_, options) {\n+        L.TileLayer.prototype.initialize.call(this, undefined, options);\n+\n+        this.options.tiles = this._formatTileURL(_);\n+\n+        this._tilejson = {};\n+\n+        this._getAttribution(_);\n+    },\n+\n+    _setTileJSON: function(json) {\n+        util.strict(json, 'object');\n+\n+        L.extend(this.options, {\n+            attribution: this.options.sanitizer(json.attribution),\n+            tms: false,","path":"src/style_layer.js","position":null,"original_position":29,"commit_id":"395e9f039d3e8c7194284a27b32bac268a11f8f4","original_commit_id":"ede0b49dd16c265701e8bb0d91554e102004d2c6","user":{"login":"jfirebaugh","id":98601,"avatar_url":"https://avatars.githubusercontent.com/u/98601?v=3","gravatar_id":"","url":"https://api.github.com/users/jfirebaugh","html_url":"https://github.com/jfirebaugh","followers_url":"https://api.github.com/users/jfirebaugh/followers","following_url":"https://api.github.com/users/jfirebaugh/following{/other_user}","gists_url":"https://api.github.com/users/jfirebaugh/gists{/gist_id}","starred_url":"https://api.github.com/users/jfirebaugh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfirebaugh/subscriptions","organizations_url":"https://api.github.com/users/jfirebaugh/orgs","repos_url":"https://api.github.com/users/jfirebaugh/repos","events_url":"https://api.github.com/users/jfirebaugh/events{/privacy}","received_events_url":"https://api.github.com/users/jfirebaugh/received_events","type":"User","site_admin":false},"body":"There are many [`L.TileLayer` options](http://leafletjs.com/reference.html#tilelayer) that will cause this class to malfunction if they are misused. Why call out `tms` specifically?","created_at":"2016-01-21T23:25:59Z","updated_at":"2016-01-21T23:25:59Z","html_url":"https://github.com/mapbox/mapbox.js/pull/1108#discussion_r50481466","pull_request_url":"https://api.github.com/repos/mapbox/mapbox.js/pulls/1108","_links":{"self":{"href":"https://api.github.com/repos/mapbox/mapbox.js/pulls/comments/50481466"},"html":{"href":"https://github.com/mapbox/mapbox.js/pull/1108#discussion_r50481466"},"pull_request":{"href":"https://api.github.com/repos/mapbox/mapbox.js/pulls/1108"}}},"pull_request":{"url":"https://api.github.com/repos/mapbox/mapbox.js/pulls/1108","id":56547852,"html_url":"https://github.com/mapbox/mapbox.js/pull/1108","diff_url":"https://github.com/mapbox/mapbox.js/pull/1108.diff","patch_url":"https://github.com/mapbox/mapbox.js/pull/1108.patch","issue_url":"https://api.github.com/repos/mapbox/mapbox.js/issues/1108","number":1108,"state":"open","locked":false,"title":"Add L.mapbox.styleLayer","user":{"login":"bsudekum","id":1058624,"avatar_url":"https://avatars.githubusercontent.com/u/1058624?v=3","gravatar_id":"","url":"https://api.github.com/users/bsudekum","html_url":"https://github.com/bsudekum","followers_url":"https://api.github.com/users/bsudekum/followers","following_url":"https://api.github.com/users/bsudekum/following{/other_user}","gists_url":"https://api.github.com/users/bsudekum/gists{/gist_id}","starred_url":"https://api.github.com/users/bsudekum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsudekum/subscriptions","organizations_url":"https://api.github.com/users/bsudekum/orgs","repos_url":"https://api.github.com/users/bsudekum/repos","events_url":"https://api.github.com/users/bsudekum/events{/privacy}","received_events_url":"https://api.github.com/users/bsudekum/received_events","type":"User","site_admin":false},"body":"This adds the ability to add a style id in place of a mapid and get raster tiles of that style. Some notes:\r\n\r\n* tiles must always be configured with [these options](https://github.com/mapbox/mapbox.js/compare/styles#diff-e1b538b03ec4f0f4fdced9f144bf186bR37)\r\n* I added the ability to add the whole style object in place of the id [here](https://github.com/mapbox/mapbox.js/compare/styles#diff-e1b538b03ec4f0f4fdced9f144bf186bR64). I'm not sure if this makes sense because it will not be configurable at run time.\r\n* The name `styleLayer` is still up for debate\r\n\r\nTests are failing because options are not properly set, any insight on this would be appreciated.\r\n\r\n/cc @jfirebaugh @tmcw ","created_at":"2016-01-20T00:30:50Z","updated_at":"2016-01-21T23:25:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"92fe80ec3402c7cf9dc08ee126e4b1b46983bf88","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mapbox/mapbox.js/pulls/1108/commits","review_comments_url":"https://api.github.com/repos/mapbox/mapbox.js/pulls/1108/comments","review_comment_url":"https://api.github.com/repos/mapbox/mapbox.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mapbox/mapbox.js/issues/1108/comments","statuses_url":"https://api.github.com/repos/mapbox/mapbox.js/statuses/395e9f039d3e8c7194284a27b32bac268a11f8f4","head":{"label":"mapbox:styles","ref":"styles","sha":"395e9f039d3e8c7194284a27b32bac268a11f8f4","user":{"login":"mapbox","id":600935,"avatar_url":"https://avatars.githubusercontent.com/u/600935?v=3","gravatar_id":"","url":"https://api.github.com/users/mapbox","html_url":"https://github.com/mapbox","followers_url":"https://api.github.com/users/mapbox/followers","following_url":"https://api.github.com/users/mapbox/following{/other_user}","gists_url":"https://api.github.com/users/mapbox/gists{/gist_id}","starred_url":"https://api.github.com/users/mapbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapbox/subscriptions","organizations_url":"https://api.github.com/users/mapbox/orgs","repos_url":"https://api.github.com/users/mapbox/repos","events_url":"https://api.github.com/users/mapbox/events{/privacy}","received_events_url":"https://api.github.com/users/mapbox/received_events","type":"Organization","site_admin":false},"repo":{"id":4875730,"name":"mapbox.js","full_name":"mapbox/mapbox.js","owner":{"login":"mapbox","id":600935,"avatar_url":"https://avatars.githubusercontent.com/u/600935?v=3","gravatar_id":"","url":"https://api.github.com/users/mapbox","html_url":"https://github.com/mapbox","followers_url":"https://api.github.com/users/mapbox/followers","following_url":"https://api.github.com/users/mapbox/following{/other_user}","gists_url":"https://api.github.com/users/mapbox/gists{/gist_id}","starred_url":"https://api.github.com/users/mapbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapbox/subscriptions","organizations_url":"https://api.github.com/users/mapbox/orgs","repos_url":"https://api.github.com/users/mapbox/repos","events_url":"https://api.github.com/users/mapbox/events{/privacy}","received_events_url":"https://api.github.com/users/mapbox/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mapbox/mapbox.js","description":"Mapbox JavaScript API, a Leaflet Plugin","fork":false,"url":"https://api.github.com/repos/mapbox/mapbox.js","forks_url":"https://api.github.com/repos/mapbox/mapbox.js/forks","keys_url":"https://api.github.com/repos/mapbox/mapbox.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapbox/mapbox.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapbox/mapbox.js/teams","hooks_url":"https://api.github.com/repos/mapbox/mapbox.js/hooks","issue_events_url":"https://api.github.com/repos/mapbox/mapbox.js/issues/events{/number}","events_url":"https://api.github.com/repos/mapbox/mapbox.js/events","assignees_url":"https://api.github.com/repos/mapbox/mapbox.js/assignees{/user}","branches_url":"https://api.github.com/repos/mapbox/mapbox.js/branches{/branch}","tags_url":"https://api.github.com/repos/mapbox/mapbox.js/tags","blobs_url":"https://api.github.com/repos/mapbox/mapbox.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapbox/mapbox.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapbox/mapbox.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapbox/mapbox.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapbox/mapbox.js/statuses/{sha}","languages_url":"https://api.github.com/repos/mapbox/mapbox.js/languages","stargazers_url":"https://api.github.com/repos/mapbox/mapbox.js/stargazers","contributors_url":"https://api.github.com/repos/mapbox/mapbox.js/contributors","subscribers_url":"https://api.github.com/repos/mapbox/mapbox.js/subscribers","subscription_url":"https://api.github.com/repos/mapbox/mapbox.js/subscription","commits_url":"https://api.github.com/repos/mapbox/mapbox.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapbox/mapbox.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapbox/mapbox.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapbox/mapbox.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapbox/mapbox.js/contents/{+path}","compare_url":"https://api.github.com/repos/mapbox/mapbox.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapbox/mapbox.js/merges","archive_url":"https://api.github.com/repos/mapbox/mapbox.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapbox/mapbox.js/downloads","issues_url":"https://api.github.com/repos/mapbox/mapbox.js/issues{/number}","pulls_url":"https://api.github.com/repos/mapbox/mapbox.js/pulls{/number}","milestones_url":"https://api.github.com/repos/mapbox/mapbox.js/milestones{/number}","notifications_url":"https://api.github.com/repos/mapbox/mapbox.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapbox/mapbox.js/labels{/name}","releases_url":"https://api.github.com/repos/mapbox/mapbox.js/releases{/id}","deployments_url":"https://api.github.com/repos/mapbox/mapbox.js/deployments","created_at":"2012-07-03T18:22:56Z","updated_at":"2016-01-20T20:11:09Z","pushed_at":"2016-01-21T22:23:43Z","git_url":"git://github.com/mapbox/mapbox.js.git","ssh_url":"git@github.com:mapbox/mapbox.js.git","clone_url":"https://github.com/mapbox/mapbox.js.git","svn_url":"https://github.com/mapbox/mapbox.js","homepage":"mapbox.com/mapbox.js/","size":12711,"stargazers_count":1175,"watchers_count":1175,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":297,"mirror_url":null,"open_issues_count":83,"forks":297,"open_issues":83,"watchers":1175,"default_branch":"mb-pages"}},"base":{"label":"mapbox:mb-pages","ref":"mb-pages","sha":"4a273aa2eb7a7fc04ceac0c37c0293e9d68b6c83","user":{"login":"mapbox","id":600935,"avatar_url":"https://avatars.githubusercontent.com/u/600935?v=3","gravatar_id":"","url":"https://api.github.com/users/mapbox","html_url":"https://github.com/mapbox","followers_url":"https://api.github.com/users/mapbox/followers","following_url":"https://api.github.com/users/mapbox/following{/other_user}","gists_url":"https://api.github.com/users/mapbox/gists{/gist_id}","starred_url":"https://api.github.com/users/mapbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapbox/subscriptions","organizations_url":"https://api.github.com/users/mapbox/orgs","repos_url":"https://api.github.com/users/mapbox/repos","events_url":"https://api.github.com/users/mapbox/events{/privacy}","received_events_url":"https://api.github.com/users/mapbox/received_events","type":"Organization","site_admin":false},"repo":{"id":4875730,"name":"mapbox.js","full_name":"mapbox/mapbox.js","owner":{"login":"mapbox","id":600935,"avatar_url":"https://avatars.githubusercontent.com/u/600935?v=3","gravatar_id":"","url":"https://api.github.com/users/mapbox","html_url":"https://github.com/mapbox","followers_url":"https://api.github.com/users/mapbox/followers","following_url":"https://api.github.com/users/mapbox/following{/other_user}","gists_url":"https://api.github.com/users/mapbox/gists{/gist_id}","starred_url":"https://api.github.com/users/mapbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapbox/subscriptions","organizations_url":"https://api.github.com/users/mapbox/orgs","repos_url":"https://api.github.com/users/mapbox/repos","events_url":"https://api.github.com/users/mapbox/events{/privacy}","received_events_url":"https://api.github.com/users/mapbox/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mapbox/mapbox.js","description":"Mapbox JavaScript API, a Leaflet Plugin","fork":false,"url":"https://api.github.com/repos/mapbox/mapbox.js","forks_url":"https://api.github.com/repos/mapbox/mapbox.js/forks","keys_url":"https://api.github.com/repos/mapbox/mapbox.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapbox/mapbox.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapbox/mapbox.js/teams","hooks_url":"https://api.github.com/repos/mapbox/mapbox.js/hooks","issue_events_url":"https://api.github.com/repos/mapbox/mapbox.js/issues/events{/number}","events_url":"https://api.github.com/repos/mapbox/mapbox.js/events","assignees_url":"https://api.github.com/repos/mapbox/mapbox.js/assignees{/user}","branches_url":"https://api.github.com/repos/mapbox/mapbox.js/branches{/branch}","tags_url":"https://api.github.com/repos/mapbox/mapbox.js/tags","blobs_url":"https://api.github.com/repos/mapbox/mapbox.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapbox/mapbox.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapbox/mapbox.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapbox/mapbox.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapbox/mapbox.js/statuses/{sha}","languages_url":"https://api.github.com/repos/mapbox/mapbox.js/languages","stargazers_url":"https://api.github.com/repos/mapbox/mapbox.js/stargazers","contributors_url":"https://api.github.com/repos/mapbox/mapbox.js/contributors","subscribers_url":"https://api.github.com/repos/mapbox/mapbox.js/subscribers","subscription_url":"https://api.github.com/repos/mapbox/mapbox.js/subscription","commits_url":"https://api.github.com/repos/mapbox/mapbox.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapbox/mapbox.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapbox/mapbox.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapbox/mapbox.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapbox/mapbox.js/contents/{+path}","compare_url":"https://api.github.com/repos/mapbox/mapbox.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapbox/mapbox.js/merges","archive_url":"https://api.github.com/repos/mapbox/mapbox.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapbox/mapbox.js/downloads","issues_url":"https://api.github.com/repos/mapbox/mapbox.js/issues{/number}","pulls_url":"https://api.github.com/repos/mapbox/mapbox.js/pulls{/number}","milestones_url":"https://api.github.com/repos/mapbox/mapbox.js/milestones{/number}","notifications_url":"https://api.github.com/repos/mapbox/mapbox.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapbox/mapbox.js/labels{/name}","releases_url":"https://api.github.com/repos/mapbox/mapbox.js/releases{/id}","deployments_url":"https://api.github.com/repos/mapbox/mapbox.js/deployments","created_at":"2012-07-03T18:22:56Z","updated_at":"2016-01-20T20:11:09Z","pushed_at":"2016-01-21T22:23:43Z","git_url":"git://github.com/mapbox/mapbox.js.git","ssh_url":"git@github.com:mapbox/mapbox.js.git","clone_url":"https://github.com/mapbox/mapbox.js.git","svn_url":"https://github.com/mapbox/mapbox.js","homepage":"mapbox.com/mapbox.js/","size":12711,"stargazers_count":1175,"watchers_count":1175,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":297,"mirror_url":null,"open_issues_count":83,"forks":297,"open_issues":83,"watchers":1175,"default_branch":"mb-pages"}},"_links":{"self":{"href":"https://api.github.com/repos/mapbox/mapbox.js/pulls/1108"},"html":{"href":"https://github.com/mapbox/mapbox.js/pull/1108"},"issue":{"href":"https://api.github.com/repos/mapbox/mapbox.js/issues/1108"},"comments":{"href":"https://api.github.com/repos/mapbox/mapbox.js/issues/1108/comments"},"review_comments":{"href":"https://api.github.com/repos/mapbox/mapbox.js/pulls/1108/comments"},"review_comment":{"href":"https://api.github.com/repos/mapbox/mapbox.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mapbox/mapbox.js/pulls/1108/commits"},"statuses":{"href":"https://api.github.com/repos/mapbox/mapbox.js/statuses/395e9f039d3e8c7194284a27b32bac268a11f8f4"}}}}