Westeros Weddings Ranked by How Much Fun a Guest Would Have
ByJames Grebey,
a Vulture contributor who writes about genre TV and movies.
Photo-Illustration: Vulture; Photos Courtesy of HBO
Wedding bells are ringing in Westeros once more — though, this being Westeros, weddings tend to be quite dangerous. (So do bells, for that matter.) Episode five of House of the Dragon featured the wedding of Rhaenyra Targaryen and Laenor Velaryon, two crazy kids who’d rather be with their uncle and their boyfriend, respectively, but had to tie the knot out of political expediency. In episode seven, Rhaenyra finally marries Uncle Daemon in a bloody little ceremony. These House of the Dragon weddings were the ninth and tenth we’ve seen onscreen in the franchise, following eight that appeared in Game of Thrones. It’s almost pedestrian compared to the real-life wedding seasons 20- and 30-somethings have endured — who among us hasn’t spent back-to-back weekends celebrating or dropped hundreds of dollars crisscrossing the country to get from one set of nuptials to the next?
Since attending a wedding as a guest is more familiar to the average person than being part of an arranged political marriage with life-or-death stakes that will decide the fate of a kingdom, it makes sense to approach the nine Westerosi weddings the way a guest might. Say you snagged an invite. Which weddings would be worth RSVPing to, and which would make you wish you never saved the date? We ranked the worst to the best.
Because Robb Stark broke his promise to marry one of Walder Frey’s daughters in exchange for passage across the Twins, Edmure Tully, the heir to Riverrun, had to wed one of his daughters as a make-good. However, Walder actually used the event as a means to kill all the Starks and their men with help from the Lannisters, who were at war with the Northmen, and the traitorous Boltons. Because you almost certainly would have been brutally murdered, the Red Wedding would be the worst Westerosi wedding to attend by far. Also, the non-deadly parts seemed like a drag. Walder Frey didn’t put any money toward décor and it shows. Highlight: The bride and groom seemed to genuinely like each other despite the circumstances. Doesn’t really make up for, you know, the rest of the night, but good for them. Lowlight: Definitely the part where the Freys and Boltons massacred all the wedding guests. The band was also quite bad, but that’s because they weren’t really “a band” so much as “crossbowmen in disguise waiting to massacre all the wedding guests.” Best off-registry gift: The Lannisters had it figured out: Skip the wedding and just send “regards.”
Rhaegar’s “abduction” of Lyanna Stark was the incident that started Robert’s Rebellion, a brutal civil war that took place almost two decades before the events of the Game of Thrones pilot,killing hundreds and ending the long Targaryen reign in Westeros. However, it turns out that Lyanna wasn’t abducted, she was actually in love with Rhaegar and they went to Dorne — the Las Vegas of Westeros, apparently — to get married in secret. (Nevermind that Rhaegar was alreadymarried.) While the actual wedding seems lovely, this would be a rough one to attend, and not just because of its future implications. This is way too small and intimate a ceremony for anyone to feel comfortable joining as a guest. Remember how weird and out-of-place Bran looked standing there, watching the wedding flashback with his Three-Eyed Raven powers? That’s how you would feel. Highlight: The beautiful, private ceremony joining two people who are passionately in love with one another. Lowlight: The lack of any sort of reception or visible bar. How’s a guest supposed to enjoy a wedding sober? Best off-registry gift: Champagne glasses inscribed with “R + L = <3.”
9.
(Tied): Robb Stark and Talisa Maegyr, Game of Thrones, “Valar Morghulis”
Photo: HBO
The King in the North had already promised himself to one of Walder Frey’s daughters in exchange for passage over the Twins, but he broke his vow when he met and fell in love with Talisa Maegyr as she was saving lives and amputating limbs on the battlefield. They got married in private, unwittingly dooming the Northern cause in the process. As with Rhaegar and Lyanna, this wedding is way too intimate to attend as a guest. The septon doesn’t ask if anybody objects, and that’s a good thing because this one would be tough to sit through if he did. Robb already promised himself to someone else, and an objection to this wedding could’ve prevented the Red Wedding — and reversed the course of the entire series. Highlight: This is the rare marriage in Westeros that’s for love, not duty, and it shows on their faces. Lowlight: At least Rhaegar and Lyanna had their secret ceremony by the side of a beautiful river. Robb and Talisa’s venue is in the dark in front of a big boring rock. Best off-registry gift: That dude’s leg they amputated together, taxidermied; a treasured memory of their first meeting.
7.
Rhaenyra and Daemon Targaryen, House of the Dragon, “Driftmark”
Photo: HBO
Yet another union too intimate for guests! The wedding between Rhaenyra Targaryen and Daemon Targaryen is a family affair — literally. After the tragic, fiery death of his second wife, Laena Velaryon, leaves him a widower, Daemon arranges a way to fake the death of Rhaenyra’s husband, Laenor Velaryon, so the two can finally marry freely. The ceremony, held on Dragonstone, sees them slicing open their lips with dragonglass and drinking blood from a goblet. You don’t need any deaths to ensure bloodshed at a Westerosi wedding. Highlight: No offense to any Targaryens who may be reading, but this wedding is super-weird, which means it will be a great story. “Yeah, and then they really drank each other’s blood!” Lowlight: Not sure about the couple’s signature wedding cocktail. Can’t a guy get a glass of Sauvignon blanc? Best off-registry gift: A donation to a Westerosi blood bank in their honor.
SansaStark’s third betrothal and second wedding has her marry Ramsay Snow, Roose Bolton’s legitimized bastard and heir to the Dreadfort. Sansa doesn’t yet know what a true sociopath Ramsay is, instead trusting that Littlefinger knows what he’s doing by arranging the nuptials. Although somewhat severe, the Old Faith wedding ceremony in front of the weirwood tree is different from the typical Westeros wedding, eschewing the Faith of the Seven’s hand-wrapping and cloak for a more austere, naturalistic call and response. It makes for an interesting evening. Highlight: An outdoor winter wedding can be a recipe for disaster, but the light snow ends up making for a beautiful venue, and Sansa looks gorgeous in her furs. Lowlight: We’re going to assume the average guest doesn’t know the full truth of Ramsay’s depravity, but the vibes are still incredibly off. Sansa’s heart is clearly not in it (can you blame her?) and Myranda, who seems to be part of the wedding party, is visibly in love with the groom and staring daggers at the bride. Awkward! Best off-registry gift: They both like dogs, so maybe some Pinterest-y “Welcome to the Pack” sign for Sansa?
5.
Tyrion Lannister and Sansa Stark, Game of Thrones, “Second Sons”
Photo: HBO
Sansa’s first wedding was only marginally better for her and her guests. Trapped in the clutches of the Lannisters, she’s forced to marry Tyrion, who isn’t super jazzed about the whole thing either. At least here it’s two kind people in a bad situation, compared to most Westeros affairs, in which at least one-half of the couple is a monster. But family drama ruins what should’ve been a fairly nice ceremony and reception; Joffrey humiliates his uncle at the altar by taking his step stool, and there’s almost a big altercation when Tryion gets too drunk at dinner. It’s the type of wedding you’ll gossip about in hushed tones with the other guests for years to come. Highlight: Based on Tyrion’s level of drunkenness, good wine and an open bar. Lowlight: Joffrey’s malicious insistence on “a bedding ceremony.” No thank you! Best off-registry gift: A cutlery set. (To ensure the groom’s shitty nephew needs to fuck his bride with a wooden cock!)
4.
Tommen Baratheon and Margaery Tyrell, Game of Thrones, “The High Sparrow”
Photo: HBO
Since Margaery Tyrell’s marriage to Joffrey Baratheon lasted all of a couple hours, the families opt for a much more modest celebration when remarrying her to Joffrey’s younger brother, a literal child even by Game of Thrones’ standards. It’s far less elaborate, and everybody mostly seems relieved it went off without a hitch. It’s possibly the least-memorable ceremony of the group, but compared to some of the others, maybe that’s not a bad thing. Get in, write your name in the guest book, wish the happy couple well, and leave without having your throat slit. Highlight: It was a basic, normal wedding that didn’t involve anything crazy! Lowlight: It was a basic, normal wedding that didn’t involve anything crazy. At the very least, Ser Pounce should’ve been part of the ceremony. Best off-registry gift: No gift. Yes, it’s gauche not to give a wedding present, but you just bought something for her and Joffrey.
3.
Rhaenyra Targaryen and Laenor Velaryon, House of the Dragon, “We Light the Way”
Photo: HBO
After Rhaenyra is accused of fooling around with her uncle, King Viserys decides she has to get married, now, to the Velaryon heir in order to shore up that political alliance. The wedding’s welcome dinner, held inside the great hall, is a big blowout that looks pretty fun provided you don’t read too much into the groom’s obvious sexuality, the bride’s jilted one-night stand, Queen Alicent’s provocative fashion, or the murder. Highlight: Doing the Targaryen equivalent of “The Cupid Shuffle” on the dance floor. Lowlight: Weddings tend to end abruptly (venue says everybody needs to GTFO at 11 p.m.!) but the murder of the groom’s lover — by the bride’s lover — really brought things to a sudden and early end. Because of that incident, the pair is married in a hasty private ceremony, depriving the guests of a lavish public celebration. Best off-registry gift: They seem like they’re going to take separate vacations, so maybe just cash.
2.
Khal Drogo and Daenerys Targaryen, Game of Thrones, “Winter Is Coming”
Photo: HBO
In the first episode of Game of Thrones, Viserys basically sells his sister Daenerys to Khal Drogo in exchange for help retaking the Iron Throne. The implications of that are obviously bad, even if Daenerys does come to love Drogo … in a way. Still, the Dothraki know how to party; Illyrio Mopatis notes that “a Dothraki wedding without at least three deaths is considered a dull affair,” so assuming you can avoid being one of the three (or more) casualties, this gathering like a great fuckin’ time. Highlight: The rowdy, sex- and violence-filled reception was a blast if you can hang, but the real highlight of these nuptials is the mercifully short wedding ceremony. Khal Drogo rode up, looked at Daenerys, didn’t kill anybody, then left. There’s nothing worse than a ceremony that goes on and on. Some call the Dothraki savages but this is the most civilized affair of them all. Lowlight: No gift can compare with three dragon eggs. Here’s a Le Creuset, Daenerys. Best off-registry gift: Assuming you don’t have money for a fourth dragon egg, Daenerys loves to soak in the tub. Maybe something from Bath & Body Works?
Ah, the Purple Wedding. Yes, it does end abruptly, and yes, it does end in chaos and the brutal murder of a child. But, consider this: The Tyrells and the Lannisters spent a ton of gold on this wedding, and it shows! The décor is immaculate, the food is lavish, there’s live theater — and the groom, who is a piece of shit, dies! An incredible wedding to attend as a guest. Highlight: The grounds outside the Red Keep are enough to inspire a destination wedding in Dubrovnik. Lowlight: Joffrey ruined what looked like a good pie by slicing it with a sword, killing the dove inside. He further ruined it by dying of poison, preventing the guests from getting a chance to taste the non-dove parts. Alas. Best off-registry gift: Something returnable.
By submitting your email, you agree to our
Terms and Privacy Notice
and to receive email correspondence from us. This site is protected by reCAPTCHA and the Google
Privacy Policy and
Terms of Service apply.
or
Already a subscriber?
What is your email?
This email will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
Password must be at least 8 characters and contain:
Lower case letters (a-z)
Upper case letters (A-Z)
Numbers (0-9)
Special Characters (!@#$%^&*)
This password will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
You’re in!
As part of your account, you’ll receive occasional updates and offers from New York, which you can opt out of anytime.
or
Already a subscriber?
What is your email?
This email will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
Password must be at least 8 characters and contain:
Lower case letters (a-z)
Upper case letters (A-Z)
Numbers (0-9)
Special Characters (!@#$%^&*)
This password will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
You’re in!
As part of your account, you’ll receive occasional updates and offers from New York, which you can opt out of anytime.
Already a subscriber?
Already a subscriber?
`;
// integrate Sub(x) scripts and elements
if (hostname !== 'subs.nymag.com') { // do not integrate on this subdomain
document.head.appendChild(trackingScript);
document.body.insertAdjacentHTML('beforeend', subXAnimationElements);
}
There was an error processing the request. Please try again later."}).catch(e=>console.error("Error verifying email: ",e)))(r.querySelector(".content"),o.bannerCTAVerification)})):(l.remove(),s.remove()),o.dismissable||n.remove(),o.useAlertIcon||a.remove(),r.classList.add("show"),n.addEventListener("click",()=>{u(),r.classList.remove("show")})}else r.remove()}});
}, {"1":1,"6":6,"12":12,"35":35,"40":40}];
window.modules["global-nav.client"] = [function(require,module,exports){"use strict";const dom=require(3),auth=require(12),signInButton=dom.find(".user-signin"),signOutButton=dom.find(".user-signout"),globalNav=dom.find('[class^="global-nav"]'),body=dom.find("body"),dropdownItems=dom.findAll(".dropdown-wrap"),gtm=require(1),appendLandingPageParams=require(136),pageUri=require(124).getPageUri(),subscriptionPromoLinks=dom.findAll(".persist-params"),searchString=window.location.search||"";function closeDropdowns(e){let n=globalNav.querySelectorAll(".dropdown.open");dropdownItems.forEach(function(t){let o=t.querySelector(".dropdown");!n||t.contains(e.target)&&27!==e.keyCode||o.classList.remove("open")})}function gtmSendReport(e,n,t){let o={eventCategory:"ecommerce",eventAction:"componentClick",brand:e,dimension23:"global-nav",list:pageUri,pageZone:"header",variant:"nav-link"};"global-nav-link"===t&&(o.eventLabel=n.href),gtm.reportNow(o)}function updateElementTargetUrlsIfQueryStrings(e){if(searchString){const n=new URLSearchParams(searchString);let t=e.href;if(t.includes("?")){const o=t.split("?"),i=new URLSearchParams(o[1]);for(let e of n.entries())i.set(e[0],e[1]);t=`${o[0]}?${i.toString()}`,e.href=t}else e.href=`${t}?${n.toString()}`}}function init(e){const n=e.querySelectorAll(".to-landing-page");window.addEventListener("auth:init",()=>{signInButton.addEventListener("click",function(e){e.preventDefault(),auth.showEmbeddedLoginFlow("top navigation")}),signOutButton.addEventListener("click",function(e){e.preventDefault(),gtmSendReport("Sign Out",e.target,"user-info-link"),auth.logout()}),auth.isAuthenticated()&&e.classList.add("signed-in"),auth.isSubscriber()&&e.classList.add("subscribed"),e.querySelectorAll(".user-link").forEach(e=>{e.classList.add("active")}),subscriptionPromoLinks.forEach(e=>{updateElementTargetUrlsIfQueryStrings(e)}),appendLandingPageParams(n)})}dropdownItems.forEach(function(e){e.addEventListener("click",function(){e.querySelector(".dropdown").classList.toggle("open")})}),body.addEventListener("click",closeDropdowns),document.addEventListener("keydown",closeDropdowns),globalNav.addEventListener("click",function(e){let n=e.target;n.classList.contains("global-nav-track")&>mSendReport(n.text,n,"global-nav-link")}),module.exports=init;
}, {"1":1,"3":3,"12":12,"124":124,"136":136}];
window.modules["aaa-module-mounting.legacy"] = [function(require,module,exports){"use strict";const _pickBy=require(221),_each=require(408),Fingerprint2=require(407),DS=require(406),Eventify=require(246);function registerGlobals(){window.DS=DS,window.Eventify=Eventify,window.Fingerprint2=Fingerprint2,DS.value("Eventify",Eventify),DS.value("Fingerprint2",Fingerprint2),DS.value("$document",window.document),DS.value("$window",window)}function mountDollarSliceComponents(){DS.service("components",["$document","$module",function(e,n){var o=_pickBy(n.definitions,e=>e.providerStrategy===n.providers.controller),r=Object.keys(o);function t(e){return o=>{try{n.get(e,o)}catch(e){logMountError(o,e)}}}_each(r,n=>{var o=e.querySelectorAll('[data-uri*="/_components/'+n+'/"]'),r=e.querySelectorAll('[data-uri$="/_components/'+n+'"]');_each(o,t(n)),_each(r,t(n))}),this.components=r}]),DS.get("components")}function logMountError(e,n){const o=e.outerHTML.slice(0,e.outerHTML.indexOf(e.innerHTML));console.error("Error attaching controller to "+o,n)}registerGlobals(),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{mountDollarSliceComponents()}):mountDollarSliceComponents();
}, {"221":221,"246":246,"406":406,"407":407,"408":408}];
window.modules["ads.legacy"] = [function(require,module,exports){"use strict";const _map=require(118),_forEach=require(107),_isString=require(268),_intersectionWith=require(409),_isEqual=require(274),_each=require(408),_debounce=require(182),_sortBy=require(205),page=require(124),visit=require(114);DS.service("adService",["Eventify","$cid","$document","$window",function(e,t,a,i){var o,n,s,r,d,c,u,l,g={},p=this,h=[],f=visit.getQueryParamsObject(["utm_campaign"]),m=document.querySelector('script[data-type="ad-a9"]'),b=[],w=!1,v=[],y=document.querySelector('script[data-name="ad-doubleverify"]');document.querySelector('script[data-name="concert-ads"]')||(i.NYM={},i.NYM.analytics={},i.NYM.analytics.adStartTime=i.performance.now(),i.googletag=i.googletag||{},i.googletag.cmd=i.googletag.cmd||[],u=i.googletag,(m||y)&&(i.googletag.cmd=i.googletag.cmd||[],i.googletag.cmd.push(function(){i.googletag.pubads().disableInitialLoad()})),m&&(l=i.setInterval(function(){void 0!==window.apstag&&void 0!==window.apstag.timeout&&(i.clearInterval(l),window.apstag.cleared=!0,l=null)},10),setTimeout(function(){l&&(i.clearInterval(l),i.googletag.pubads().refresh(),window.apstag||console.log("MESSAGE: Timeout for A9 load exceeded, aborting"))},500)),y&&(b.push(new Promise(function(e){w?e():v.push(e)})),c=i.setTimeout(T,2500)),o=function(e){var t,a,o=e.data,n=[];return o.loaded?e:(o.loaded=!0,t=null,(t=o.sizes?u.defineSlot(o.name,o.sizes,o.id).addService(u.pubads()):u.defineOutOfPageSlot(o.name,o.id).addService(u.pubads())).setTargeting("adid",o.id),f.hasOwnProperty("utm_campaign")&&t.setTargeting("utmcamp",f.utm_campaign),a=p.getAdCount(o.label),t.setTargeting("label",o.label+"_"+o.site+"-"+a),u.display(o.id),u.pubads().addEventListener("slotOnload",function(){i.NYM.analytics.firstAdLoadTime||(i.NYM.analytics.firstAdLoadTime=i.performance.now(),i.NYM.analytics.firstAdLoadLabel=e.data.label)}),n=_(o),Promise.all(b).then(function(){n?window.apstag&&window.apstag.cleared?window.apstag.fetchBids({slots:[n],timeout:window.apstag.timeout},function(){u.cmd.push(function(){window.apstag.setDisplayBids(),u.pubads().refresh([t],{changeCorrelator:!1})})}):y&&u.pubads().refresh([t],{changeCorrelator:!1}):u.pubads().refresh([t],{changeCorrelator:!1})}),e.slot=t,e)},n=function(e){var a,i,o,n=t(),s=e.getAttribute("data-name"),r=e.getAttribute("data-sizes"),d=e.getAttribute("data-label"),c=e.getAttribute("data-site");n=e.id,r&&r.length?(r=r.split(","),a=[],_map(r,function(e){e=e.split("x"),i=parseInt(e[0]),o=parseInt(e[1]),a.push([i,o])})):(e.classList.add("oop"),a=!1),this.data={id:n,name:s,sizes:a,loaded:!1,label:d,site:c},g[n]=this},r=function(e){u.cmd.push(function(){var t=o(e);g[e.data.id]=t})},s=function(e){var t=[];e.slot?(t=_(e))&&window.apstag&&window.apstag.cleared&&window.apstag.fetchBids({slots:[t],timeout:window.apstag.timeout},function(){u.cmd.push(function(){window.apstag.setDisplayBids(),u.pubads().refresh([e.slot],{changeCorrelator:!1})})}):e&&r(e)},u.cmd.push(function(){var e,t,o,n=page.getMeta("article:tag"),s=page.getMeta("author"),r=i.location.href,d=(e=a.head.querySelector(".head-gtm"),t=a.body.querySelector(".gtm"),e&&"top"===e.getAttribute("data-gtm")?"gtmtop":t&&"bottom"===t.getAttribute("data-gtm")?"gtmbottom":"");o=[],_forEach([n,s,d],function(e){_forEach(e.split(","),function(e){(e=e.trim().toLowerCase().replace(/\s/g,"-").replace(/\'|\’/g,"")).length&&o.push(e)})}),u.pubads().setTargeting("kw",o),u.pubads().setTargeting("entry_group",o),r=r.slice(r.lastIndexOf("/")+1),u.pubads().setTargeting("pn",r),u.companionAds().setRefreshUnfilledSlots(!0),u.pubads().enableAsyncRendering(),u.enableServices()}),this.load=r,this.create=function(e){return new n(e)},this.refresh=function(e){var t;_isString(e)?(t=this.getById(e),s(t)):s(e)},this.remove=function(e){var t=e.data.id;a.getElementById(t).innerHTML=""},this.getAdCount=function(e){var t,a=0,i=Object.keys(g);return _each(i,function(i){(t=g[i]).data.loaded&&t.data.label===e&&a++}),a},this.getById=function(e){return g[e]},d=_debounce(function(){var e={TopLeaderboard:1,RightColTopMPU:2,outOfPage:99,"homepageTakeover/TopLeaderboard":1},t=_sortBy(h,function(t){return e[t.data.label]||10});_forEach(t,function(e){return e.data.sizes?r(e):i.setTimeout(function(){r(e)},2e3)}),y&&window.PQ.cmd.push(()=>{try{window.PQ.loadSignals(["ids","bsc","vlp"],T)}catch(e){T(),console.error(`There has been an error loading Double Verify signals: ${e}`)}}),h=[]},10),this.addToPageLoadQueue=function(e){h.push(e),d()});function _(e){var t,a=e.sizes;return a=_intersectionWith(a,[[970,250],[970,90],[728,90],[300,600],[300,250],[320,100],[320,50]],_isEqual),e.sizes&&e.sizes.length&&(t={slotID:e.id,sizes:a,slotName:e.label}),t}function T(){i.clearTimeout(c),w=!0,_forEach(v,function(e){e()})}}]);
}, {"107":107,"114":114,"118":118,"124":124,"182":182,"205":205,"268":268,"274":274,"408":408,"409":409}];
window.modules["cid.legacy"] = [function(require,module,exports){"use strict";DS.service("$cid",function(){var r=Math.floor(100*Math.random());return function(){return"cid-"+ ++r}});
}, {}];
window.modules["client.legacy"] = [function(require,module,exports){"use strict";require("cid.legacy"),require("ads.legacy"),require("facebook.legacy"),require("aaa-module-mounting.legacy");
}, {"cid.legacy":"cid.legacy","aaa-module-mounting.legacy":"aaa-module-mounting.legacy","ads.legacy":"ads.legacy","facebook.legacy":"facebook.legacy"}];
window.modules["facebook.legacy"] = [function(require,module,exports){"use strict";DS.service("facebook",[function(){this.fb=function(i){window.FB&&window.FB[i].apply(this,Array.prototype.slice.call(arguments,1))}}]);
}, {}];
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o typeof key === 'string' && key.match(/\.legacy$/)).forEach(key => window.require(key));
}
function tryToMount(fn, el, name) {
try {
fn(el); // init the controller
} catch (e) {
const elementTag = el.outerHTML.slice(0, el.outerHTML.indexOf(el.innerHTML));
console.error(`Error initializing controller for "${name}" on "${elementTag}"`, e);
}
}
/**
* mount client.js component controllers
*/
function mountComponentModules() {
Object.keys(window.modules).filter(key => typeof key === 'string' && key.match(/\.client$/)).forEach(key => {
let controllerFn = window.require(key);
if (typeof controllerFn === 'function') {
const name = key.replace('.client', ''),
instancesSelector = `[data-uri*="_components/${name}/"]`,
defaultSelector = `[data-uri$="_components${name}"]`,
instances = document.querySelectorAll(instancesSelector),
defaults = document.querySelectorAll(defaultSelector);
for (let el of instances) {
tryToMount(controllerFn, el, name);
}
for (let el of defaults) {
tryToMount(controllerFn, el, name);
}
}
});
}
// Make sure that a `window.process.env.NODE_ENV` is available in the client for any dependencies,
// services, or components that could require it
// note: the `` value is swapped for the actual environment variable in /lib/cmd/compile/scripts.js
window.process = window.process || {};
window.process.env = window.process.env || {};
if (!window.process.env.NODE_ENV) {
window.process.env.NODE_ENV = '';
}
// note: legacy controllers that require legacy services (e.g. dollar-slice) must
// wait for DOMContentLoaded to initialize themselves, as the files themselves must be mounted first
mountLegacyServices();
mountComponentModules();
// ]]