Edward I's second daughter, Joan of Acre, married Gilbert de Clare, earl of Gloucester, on 30 April 1290. Thirteen days before the wedding, Edward met Gloucester at Amesbury in Wiltshire, and made him swear on the saints that he would uphold the rights of the succession to the throne.
In 1290, only one of Edward I's four sons was still living - Edward of Caernarfon, not quite six when the document was signed. Edward's queen, Eleanor of Castile, was in her late forties and past childbearing. Child mortality being what it was, Edward must have been concerned that his youngest son might also die. It's interesting to see that, in this event, Edward I wanted his kingdom to pass to his daughters, rather than, say, Thomas or Henry of Lancaster, his brother's sons. The agreement probably also represents Edward I's concerns over the ambitions of the earl of Gloucester.
Eleanor was the eldest surviving daughter of Edward I and Eleanor of Castile, almost twenty-one in April 1290 (she was born in June 1269, not 1264 as often stated, as this entry from the Patent Rolls proves). At the time, she was betrothed to Alfonso III, king of Aragon.
Here's my translation of the document - the French original can be seen here.
To all those who hear or see these letters, Gilbert de Clare, earl of Gloucester and Hertford, greetings.
As our lord the king, by his grace, has consented to give me the lady Joan, his daughter, to wife, I, to prevent all doubts and suspicions, have sworn on the saints,
in the presence of:
John [Pecham], by the grace of God, archbishop of Canterbury
Robert [Burnell], bishop of Bath and Wells [Bath is spelt 'Baa' in the original!]
John [of Pontoise], bishop of Winchester
Anthony [Bek], bishop of Durham
Peter [Quinel], bishop of Exeter
Godfrey [Giffard], bishop of Worcester
Sir William de Valence, uncle of the king
Sir Edmund [of Lancaster], brother of the king
Sir Henry de Lacy, earl of Lincoln
Sir Otto de Grandisson
Sir William de Brecuse
Sir John de Saint John
Master William de Lue
John de Berwick
That, should it happen (which GOD forbid) that GOD make his commandment to our lord the king [that is, if the king dies], and I remain alive, I will bear good faith [jo bone fey porteray] to my Lord Edward, his son, owing to my liege lord, and uphold the rights of his kingdom.
Or, if GOD make his commandment to this same Lord Edward, without begotten heirs of his body, but another son of my lord the king above-mentioned is living; I, to this same son, and to the begotten heirs of his body, should he have them, will bear the good faith owing to my lord.
And, if by misfortune it should happen that GOD make his commandment to our lord the king, and to his sons, and they have no heirs of their bodies: if the Lady Eleanor, eldest daughter of my lord the king above-mentioned, is alive, I will bear good faith to this same Eleanor, and the begotten heirs of her body, and in no manner, not by force, nor by deceit, disturb her rights, nor her, nor the heirs of her body, should she have them, nor the kingdom of England nor the land of Ireland, according to the ordinance of our lord the king above-mentioned; which ordinance is such, that is to say:
That our lord the king wishes and ordains that should the Lord Edward, his son, or another son, should he have one, remain without heirs of his body; that therefore, after the death of our lord the king above-mentioned, the kingdom of England, and the land of Ireland, remain to Lady Eleanor, his eldest daughter, and the begotten heirs of her body.
And if this same Lady Eleanor remain without heirs of her body, then the kingdom, and the land above-mentioned, remain to Lady Joan, daughter of the king above-mentioned, and to the heirs of her body.
And if this same Lady Joan remain without heirs of her body, the kingdom and the above-mentioned land of Ireland remain to the next sister, and thence from daughter to daughter, and from heir to heir, from the Lady Eleanor to the Lady Joan.
And, to loyally hold and keep these things, I submit myself to the jurisdiction and the constraint of the apostle of Rome, and the church of Rome; and the jurisdiction and constraint of the archbishops of Canterbury and York; and of all the prelates of England who are at this time; and to the constraint and jurisdiction of each of them alone.
And in testimony of these things, I have put my seal to this letter, and at my request, the honourable Father John, by the grace of God archbishop of Canterbury, Robert, bishop of Bath and Wells, John, bishop of Winchester, Anthony, bishop of Durham, Peter, bishop of Exeter, and Godfrey, bishop of Worcester, have put their seals to these letters.
Given at Amesbury [Aumbresbyrie] the Monday next before the feast of St Alphege, the nineteenth year of the reign of King Edward above-mentioned [17 April 1290]
Of course, Edward II did live, and did beget heirs of his body, so to speak, and Edward I had two younger sons by his second marriage, so the issue of Eleanor inheriting never arose. It's an interesting 'what if', though.
Eleanor remained next in line to the throne until her death at the age of twenty-nine in August 1298. Then, the next heir to England was her young son, the future Count Edouard I of Bar, until he was deplaced in June 1300 by the birth of Edward I's son by Marguerite of France, Thomas of Brotherton, and pushed further down the line when Edward I's youngest son Edmund of Woodstock was born in August 1301. Thomas of Brotherton was heir to the throne behind Edward of Caernarfon/Edward II until the birth of the future Edward III in November 1312.